Skip to content

Commit 1dcbde9

Browse files
committed
fix(ui): correct keyboard shortcuts guard logic
1 parent af89fb1 commit 1dcbde9

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

app/components/Button/Base.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ const props = withDefaults(
2626
2727
const el = useTemplateRef('el')
2828
29-
const keyboardShortcutsEnabled = computed(() => import.meta.client && useKeyboardShortcuts().value)
29+
const keyboardShortcuts = useKeyboardShortcuts()
30+
const keyboardShortcutsEnabled = computed(() => import.meta.client && keyboardShortcuts.value)
3031
3132
defineExpose({
3233
focus: () => el.value?.focus(),

app/components/Compare/PackageSelector.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,7 @@ function removePackage(name: string) {
9797
packages.value = packages.value.filter(p => p !== name)
9898
}
9999
100-
const keyboardShortcutsEnabled = useKeyboardShortcuts()
101-
102100
function handleKeydown(e: KeyboardEvent) {
103-
if (!keyboardShortcutsEnabled) return
104-
105101
const items = navigableItems.value
106102
const count = items.length
107103

app/pages/settings.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ const { settings } = useSettings()
55
const { locale, locales, setLocale: setNuxti18nLocale } = useI18n()
66
const colorMode = useColorMode()
77
const { currentLocaleStatus, isSourceLocale } = useI18nStatus()
8+
const keyboardShortcutsEnabled = useKeyboardShortcuts()
89
910
// Escape to go back (but not when focused on form elements or modal is open)
1011
onKeyStroke(
1112
e =>
13+
keyboardShortcutsEnabled.value &&
1214
isKeyWithoutModifiers(e, 'Escape') &&
1315
!isEditableElement(e.target) &&
1416
!document.documentElement.matches('html:has(:modal)'),

0 commit comments

Comments
 (0)