🐛(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:
committed by
aleb_the_flash
parent
224b98fd9a
commit
d44b45b6aa
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user