-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix supertab freezing the app #6965
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -42,7 +42,7 @@ export function addGlobalKeyboardShortcuts(): void { | |||||||||||||||||||||
return; | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
// Super tab :) | ||||||||||||||||||||||
// Super tab :( | ||||||||||||||||||||||
if ( | ||||||||||||||||||||||
(commandOrCtrl && key === 'F6') || | ||||||||||||||||||||||
(commandOrCtrl && !shiftKey && (key === 't' || key === 'T')) | ||||||||||||||||||||||
|
@@ -55,10 +55,7 @@ export function addGlobalKeyboardShortcuts(): void { | |||||||||||||||||||||
const focusedIndexes: Array<number> = []; | ||||||||||||||||||||||
|
||||||||||||||||||||||
targets.forEach((target, index) => { | ||||||||||||||||||||||
if ( | ||||||||||||||||||||||
(focusedElement != null && target === focusedElement) || | ||||||||||||||||||||||
target.contains(focusedElement) | ||||||||||||||||||||||
) { | ||||||||||||||||||||||
if (target.contains(focusedElement)) { | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||
focusedIndexes.push(index); | ||||||||||||||||||||||
} | ||||||||||||||||||||||
}); | ||||||||||||||||||||||
|
@@ -75,22 +72,7 @@ export function addGlobalKeyboardShortcuts(): void { | |||||||||||||||||||||
// elements match (generally going to be a parent element) | ||||||||||||||||||||||
const focusedIndex = focusedIndexes.at(-1) ?? -1; | ||||||||||||||||||||||
|
||||||||||||||||||||||
const lastIndex = targets.length - 1; | ||||||||||||||||||||||
const increment = shiftKey ? -1 : 1; | ||||||||||||||||||||||
|
||||||||||||||||||||||
let index; | ||||||||||||||||||||||
if (focusedIndex < 0 || focusedIndex >= lastIndex) { | ||||||||||||||||||||||
index = 0; | ||||||||||||||||||||||
} else { | ||||||||||||||||||||||
index = focusedIndex + increment; | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
while (!targets[index]) { | ||||||||||||||||||||||
index += increment; | ||||||||||||||||||||||
if (index > lastIndex || index < 0) { | ||||||||||||||||||||||
index = 0; | ||||||||||||||||||||||
} | ||||||||||||||||||||||
} | ||||||||||||||||||||||
const index = (focusedIndex + 1) % targets.length; | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed
Suggested change
|
||||||||||||||||||||||
|
||||||||||||||||||||||
const node = targets[index]; | ||||||||||||||||||||||
const firstFocusableElement = matchOrQueryFocusable(node); | ||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signal Spirits haunt this codebase. Let the frown scare them away.