@@ -36,7 +36,7 @@ class Interactive extends React.Component {
36
36
buttonDown : false ,
37
37
clickType : 'reset' ,
38
38
focus : false ,
39
- previousFocus : 'reset' ,
39
+ previousFocus : false ,
40
40
focusTransition : 'reset' ,
41
41
focusStateOnMouseDown : false ,
42
42
spaceKeyDown : false ,
@@ -504,6 +504,7 @@ class Interactive extends React.Component {
504
504
if ( this . track . state . focus && ! newState . focus ) {
505
505
setNON ( 'blur' ) ;
506
506
this . manageSetTimeout ( 'elementBlur' , ( ) => {
507
+ this . track . previousFocus = false ;
507
508
cancelNON ( 'blur' ) ;
508
509
} , queueTime ) ;
509
510
}
@@ -553,7 +554,7 @@ class Interactive extends React.Component {
553
554
// window focus event
554
555
case 'focus' :
555
556
// if the window focus event is not followed by an element focus event, then reset focus
556
- if ( this . track . focus ) {
557
+ if ( this . track . previousFocus !== false ) {
557
558
this . manageSetTimeout ( 'windowFocus' , ( ) => {
558
559
this . track . focus = false ;
559
560
} , queueTime ) ;
@@ -566,8 +567,6 @@ class Interactive extends React.Component {
566
567
this . cancelTimeout ( 'elementBlur' ) ;
567
568
// notifiy of the next window focus event (re-entering the app/window/tab)
568
569
this . track . notifyOfNext . focus = notifyOfNext ( 'focus' , this . handleNotifyOfNext ) ;
569
- // reinstate focus to it's previous value to preserve the focus state
570
- this . track . focus = this . track . previousFocus ;
571
570
break ;
572
571
default :
573
572
}
@@ -1051,6 +1050,8 @@ class Interactive extends React.Component {
1051
1050
this . track . focus = 'mouse' ;
1052
1051
} else if ( / t o u c h / . test ( focusTransition ) || this . track . touchDown ) {
1053
1052
this . track . focus = 'touch' ;
1053
+ } else if ( this . track . previousFocus ) {
1054
+ this . track . focus = this . track . previousFocus ;
1054
1055
} else if ( ! / f o r c e S t a t e / . test ( focusTransition ) ) {
1055
1056
this . track . focus = 'tab' ;
1056
1057
}
0 commit comments