File tree Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -117,8 +117,7 @@ class FocusTrap extends FocusMixin(LitElement) {
117
117
// user is exiting trap via forward tabbing...
118
118
const firstFocusable = getNextFocusable ( this . shadowRoot . querySelector ( '.d2l-focus-trap-start' ) ) ;
119
119
if ( firstFocusable ) {
120
- // Delay to re-apply the focus effects as a visual clue when there is only one focusable element
121
- setTimeout ( ( ) => firstFocusable . focus ( ) , 50 ) ;
120
+ firstFocusable . focus ( ) ;
122
121
return ;
123
122
}
124
123
}
@@ -141,8 +140,7 @@ class FocusTrap extends FocusMixin(LitElement) {
141
140
// user is exiting trap via back tabbing...
142
141
const lastFocusable = getPreviousFocusable ( this . shadowRoot . querySelector ( '.d2l-focus-trap-end' ) ) ;
143
142
if ( lastFocusable ) {
144
- // Delay to re-apply the focus effects as a visual clue when there is only one focusable element
145
- setTimeout ( ( ) => lastFocusable . focus ( ) , 50 ) ;
143
+ lastFocusable . focus ( ) ;
146
144
return ;
147
145
}
148
146
}
Original file line number Diff line number Diff line change @@ -106,14 +106,12 @@ describe('d2l-focus-trap', () => {
106
106
it ( 'wraps to first' , async ( ) => {
107
107
focusTrap . querySelector ( '#last' ) . focus ( ) ;
108
108
focusTrap . shadowRoot . querySelector ( '.d2l-focus-trap-end' ) . focus ( ) ;
109
- clock . tick ( 50 ) ;
110
109
expect ( document . activeElement ) . to . equal ( elem . querySelector ( '#first' ) ) ;
111
110
} ) ;
112
111
113
112
it ( 'wraps to last' , ( ) => {
114
113
focusTrap . querySelector ( '#first' ) . focus ( ) ;
115
114
focusTrap . shadowRoot . querySelector ( '.d2l-focus-trap-start' ) . focus ( ) ;
116
- clock . tick ( 50 ) ;
117
115
expect ( document . activeElement ) . to . equal ( elem . querySelector ( '#last' ) ) ;
118
116
} ) ;
119
117
You can’t perform that action at this time.
0 commit comments