@@ -620,6 +620,7 @@ export class ReplayContainer implements ReplayContainerInterface {
620
620
WINDOW . document . addEventListener ( 'visibilitychange' , this . _handleVisibilityChange ) ;
621
621
WINDOW . addEventListener ( 'blur' , this . _handleWindowBlur ) ;
622
622
WINDOW . addEventListener ( 'focus' , this . _handleWindowFocus ) ;
623
+ WINDOW . addEventListener ( 'keydown' , this . _handleKeyboardEvent ) ;
623
624
624
625
// There is no way to remove these listeners, so ensure they are only added once
625
626
if ( ! this . _hasInitializedCoreListeners ) {
@@ -648,6 +649,7 @@ export class ReplayContainer implements ReplayContainerInterface {
648
649
649
650
WINDOW . removeEventListener ( 'blur' , this . _handleWindowBlur ) ;
650
651
WINDOW . removeEventListener ( 'focus' , this . _handleWindowFocus ) ;
652
+ WINDOW . removeEventListener ( 'keydown' , this . _handleKeyboardEvent ) ;
651
653
652
654
if ( this . _performanceObserver ) {
653
655
this . _performanceObserver . disconnect ( ) ;
@@ -698,6 +700,11 @@ export class ReplayContainer implements ReplayContainerInterface {
698
700
this . _doChangeToForegroundTasks ( breadcrumb ) ;
699
701
} ;
700
702
703
+ /** Ensure page remains active when a key is pressed. */
704
+ private _handleKeyboardEvent : ( event : KeyboardEvent ) => void = ( ) => {
705
+ this . triggerUserActivity ( ) ;
706
+ } ;
707
+
701
708
/**
702
709
* Tasks to run when we consider a page to be hidden (via blurring and/or visibility)
703
710
*/
0 commit comments