File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -33,10 +33,10 @@ export class OverlayStack {
3333
3434 public constructor ( ) {
3535 this . addEventListeners ( ) ;
36- this . initTabTrapping ( ) ;
3736 }
3837
3938 private canTabTrap = true ;
39+ private trappingInited = false ;
4040 private tabTrapper ! : HTMLElement ;
4141 private overlayHolder ! : HTMLElement ;
4242
@@ -90,6 +90,11 @@ export class OverlayStack {
9090 }
9191
9292 private startTabTrapping ( ) : void {
93+ if ( ! this . trappingInited ) {
94+ this . initTabTrapping ( ) ;
95+ this . trappingInited = true ;
96+ }
97+ /* c8 ignore next 3 */
9398 if ( ! this . canTabTrap ) {
9499 return ;
95100 }
@@ -99,7 +104,7 @@ export class OverlayStack {
99104
100105 private stopTabTrapping ( ) : void {
101106 /* c8 ignore next 3 */
102- if ( ! this . canTabTrap ) {
107+ if ( ! this . canTabTrap || ! this . trappingInited ) {
103108 return ;
104109 }
105110 this . tabTrapper . removeAttribute ( 'tabindex' ) ;
You can’t perform that action at this time.
0 commit comments