🐛(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
This commit is contained in:
lebaudantoine
2025-07-23 11:17:23 +02:00
committed by aleb_the_flash
parent 224b98fd9a
commit d44b45b6aa

View File

@@ -12,6 +12,7 @@ export const useKeyboardShortcuts = () => {
// Issues might occur. First draft.
const onKeyDown = (e: KeyboardEvent) => {
const { key, metaKey, ctrlKey } = e
if (!key) return
const shortcutKey = formatShortcutKey({
key,
ctrlKey: ctrlKey || (isMacintosh() && metaKey),