-
-
Notifications
You must be signed in to change notification settings - Fork 36
normalizeKeyName doesn't have a guard #97
Copy link
Copy link
Closed
Description
TanStack Hotkeys version
v0.9.0
Framework/Library version
React v19.2.4
Describe the bug and the steps to reproduce it
normalizeKeyName calls key.toUpperCase() without guarding against undefined, and event.key can be undefined in rare cases (browser extensions synthesizing key events, accessibility tools, certain OS/browser combinations).
To reproduce it, just paste this code in console of a project with hotkeys:
const event = new KeyboardEvent('keydown', { bubbles: true });
Object.defineProperty(event, 'key', { get: () => undefined });
document.dispatchEvent(event);
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://codesandbox.io/p/sandbox/purple-wood-3d74qc
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
Yes, I am also opening a PR that solves the problem along side this issue
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels