[Accessibility] Use keybindings to add keybindings (#2384)

This commit is contained in:
filtered
2025-02-01 04:46:23 +11:00
committed by GitHub
parent ee6197785a
commit 4eed9c7e53

View File

@@ -213,6 +213,17 @@ function removeKeybinding(commandData: ICommandData) {
}
function captureKeybinding(event: KeyboardEvent) {
// Allow the use of keyboard shortcuts when adding keyboard shortcuts
if (!event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey) {
switch (event.key) {
case 'Escape':
cancelEdit()
return
case 'Enter':
saveKeybinding()
return
}
}
const keyCombo = KeyComboImpl.fromEvent(event)
newBindingKeyCombo.value = keyCombo
}