File tree 1 file changed +3
-21
lines changed
1 file changed +3
-21
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ export function addGlobalKeyboardShortcuts(): void {
42
42
return ;
43
43
}
44
44
45
- // Super tab :)
45
+ // Super tab :(
46
46
if (
47
47
( commandOrCtrl && key === 'F6' ) ||
48
48
( commandOrCtrl && ! shiftKey && ( key === 't' || key === 'T' ) )
@@ -55,10 +55,7 @@ export function addGlobalKeyboardShortcuts(): void {
55
55
const focusedIndexes : Array < number > = [ ] ;
56
56
57
57
targets . forEach ( ( target , index ) => {
58
- if (
59
- ( focusedElement != null && target === focusedElement ) ||
60
- target . contains ( focusedElement )
61
- ) {
58
+ if ( target . contains ( focusedElement ) ) {
62
59
focusedIndexes . push ( index ) ;
63
60
}
64
61
} ) ;
@@ -75,22 +72,7 @@ export function addGlobalKeyboardShortcuts(): void {
75
72
// elements match (generally going to be a parent element)
76
73
const focusedIndex = focusedIndexes . at ( - 1 ) ?? - 1 ;
77
74
78
- const lastIndex = targets . length - 1 ;
79
- const increment = shiftKey ? - 1 : 1 ;
80
-
81
- let index ;
82
- if ( focusedIndex < 0 || focusedIndex >= lastIndex ) {
83
- index = 0 ;
84
- } else {
85
- index = focusedIndex + increment ;
86
- }
87
-
88
- while ( ! targets [ index ] ) {
89
- index += increment ;
90
- if ( index > lastIndex || index < 0 ) {
91
- index = 0 ;
92
- }
93
- }
75
+ const index = ( focusedIndex + 1 ) % targets . length ;
94
76
95
77
const node = targets [ index ] ;
96
78
const firstFocusableElement = matchOrQueryFocusable ( node ) ;
You can’t perform that action at this time.
0 commit comments