File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ export default function scopeTab(node, event) {
99 return ;
1010 }
1111
12+ let target ;
13+
1214 const shiftKey = event . shiftKey ;
1315 const head = tabbable [ 0 ] ;
1416 const tail = tabbable [ tabbable . length - 1 ] ;
@@ -20,7 +22,6 @@ export default function scopeTab(node, event) {
2022 target = tail ;
2123 }
2224
23- var target ;
2425 if ( tail === document . activeElement && ! shiftKey ) {
2526 target = head ;
2627 }
@@ -62,9 +63,11 @@ export default function scopeTab(node, event) {
6263 x += shiftKey ? - 1 : 1 ;
6364 }
6465
66+ target = tabbable [ x ] ;
67+
6568 // If the tabbable element does not exist,
6669 // focus head/tail based on shiftKey
67- if ( typeof tabbable [ x ] === "undefined" ) {
70+ if ( typeof target === "undefined" ) {
6871 event . preventDefault ( ) ;
6972 target = shiftKey ? tail : head ;
7073 target . focus ( ) ;
@@ -73,5 +76,5 @@ export default function scopeTab(node, event) {
7376
7477 event . preventDefault ( ) ;
7578
76- tabbable [ x ] . focus ( ) ;
79+ target . focus ( ) ;
7780}
You can’t perform that action at this time.
0 commit comments