File tree 1 file changed +6
-3
lines changed
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) {
9
9
return ;
10
10
}
11
11
12
+ let target ;
13
+
12
14
const shiftKey = event . shiftKey ;
13
15
const head = tabbable [ 0 ] ;
14
16
const tail = tabbable [ tabbable . length - 1 ] ;
@@ -20,7 +22,6 @@ export default function scopeTab(node, event) {
20
22
target = tail ;
21
23
}
22
24
23
- var target ;
24
25
if ( tail === document . activeElement && ! shiftKey ) {
25
26
target = head ;
26
27
}
@@ -62,9 +63,11 @@ export default function scopeTab(node, event) {
62
63
x += shiftKey ? - 1 : 1 ;
63
64
}
64
65
66
+ target = tabbable [ x ] ;
67
+
65
68
// If the tabbable element does not exist,
66
69
// focus head/tail based on shiftKey
67
- if ( typeof tabbable [ x ] === "undefined" ) {
70
+ if ( typeof target === "undefined" ) {
68
71
event . preventDefault ( ) ;
69
72
target = shiftKey ? tail : head ;
70
73
target . focus ( ) ;
@@ -73,5 +76,5 @@ export default function scopeTab(node, event) {
73
76
74
77
event . preventDefault ( ) ;
75
78
76
- tabbable [ x ] . focus ( ) ;
79
+ target . focus ( ) ;
77
80
}
You can’t perform that action at this time.
0 commit comments