From 01fa85c7a3e476d4f710ed3a36c1e815fc986a94 Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Thu, 1 Jun 2023 15:26:46 +0200 Subject: [PATCH] fix(defineShortcuts): err with input autocomplete that triggers `keydown` --- src/runtime/composables/defineShortcuts.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runtime/composables/defineShortcuts.ts b/src/runtime/composables/defineShortcuts.ts index d2b5a7a5..b4be4fc9 100644 --- a/src/runtime/composables/defineShortcuts.ts +++ b/src/runtime/composables/defineShortcuts.ts @@ -33,6 +33,9 @@ export const defineShortcuts = (config: ShortcutsConfig) => { let shortcuts: Shortcut[] = [] const onKeyDown = (e: KeyboardEvent) => { + // Input autocomplete triggers a keydown event + if (!e.key) { return } + const alphabeticalKey = /^[a-z]{1}$/i.test(e.key) for (const shortcut of shortcuts) {