Skip to content

Commit d44b45b

Browse files
committed
🐛(frontend) prevent shortcut handling when key is undefined
Add null check to avoid processing keyboard shortcuts with undefined key values that could cause errors. Exception caught in PostHog
1 parent 224b98f commit d44b45b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/frontend/src/features/shortcuts/useKeyboardShortcuts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export const useKeyboardShortcuts = () => {
1212
// Issues might occur. First draft.
1313
const onKeyDown = (e: KeyboardEvent) => {
1414
const { key, metaKey, ctrlKey } = e
15+
if (!key) return
1516
const shortcutKey = formatShortcutKey({
1617
key,
1718
ctrlKey: ctrlKey || (isMacintosh() && metaKey),

0 commit comments

Comments
 (0)