File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,9 @@ const Portal = {
8282 return
8383 }
8484
85+ if ( this . __portalIsActive === true ) { return }
86+ this . __portalIsActive = true
87+
8588 if ( this . focusObj === void 0 ) {
8689 this . focusObj = { }
8790 }
@@ -116,6 +119,7 @@ const Portal = {
116119 } ,
117120
118121 __hidePortal ( ) {
122+ this . __portalIsActive = false
119123 removeFocusWaitFlag ( this . focusObj )
120124
121125 if ( this . __portal !== void 0 ) {
Original file line number Diff line number Diff line change 11let queue = [ ]
2- const waitFlags = [ ]
2+ let waitFlags = [ ]
3+
4+ function clearFlag ( flag ) {
5+ waitFlags = waitFlags . filter ( entry => entry !== flag )
6+ }
37
48export function addFocusWaitFlag ( flag ) {
9+ clearFlag ( flag )
510 waitFlags . push ( flag )
611}
712
813export function removeFocusWaitFlag ( flag ) {
9- const index = waitFlags . indexOf ( flag )
10- if ( index !== - 1 ) {
11- waitFlags . splice ( index , 1 )
12- }
14+ clearFlag ( flag )
1315
1416 if ( waitFlags . length === 0 && queue . length > 0 ) {
1517 // only call last focus handler (can't focus multiple things at once)
@@ -29,8 +31,5 @@ export function addFocusFn (fn) {
2931}
3032
3133export function removeFocusFn ( fn ) {
32- const index = queue . indexOf ( fn )
33- if ( index !== - 1 ) {
34- queue . splice ( index , 1 )
35- }
34+ queue = queue . filter ( entry => entry !== fn )
3635}
You can’t perform that action at this time.
0 commit comments