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#