TanStack Hotkeys version
10.0.0
Framework/Library version
React v19.2.0
Describe the bug and the steps to reproduce it
useKeyHold('Shift') (and every consumer of the global KeyStateTracker) can get permanently stuck reporting a modifier as held. The tracker only learns a key was released from a discrete keyup event, and its only recovery path for a missed keyup is a window blur. Any OS-level interaction that swallows the keyup without blurring the browser window strands the held state indefinitely — every subsequent useKeyHold read returns true until the user physically taps and releases that key again.
Reproduction
- Render anything using
const shift = useKeyHold('Shift').
- On macOS, focus the page and press Cmd+Shift+4 (screenshot-to-selection).
- Press Esc to cancel (or take the shot).
- Observe
useKeyHold('Shift') is now stuck at true, even though nothing is held.
Other triggers in the same class: Spotlight (Cmd+Space), Mission Control, and various OS shortcuts that consume a modifier keyup while leaving the browser window focused.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://codesandbox.io/p/sandbox/stoic-fast-h5k2pr
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
No, because I do not have time to dig into it
Terms & Code of Conduct
TanStack Hotkeys version
10.0.0
Framework/Library version
React v19.2.0
Describe the bug and the steps to reproduce it
useKeyHold('Shift')(and every consumer of the globalKeyStateTracker) can get permanently stuck reporting a modifier as held. The tracker only learns a key was released from a discretekeyupevent, and its only recovery path for a missedkeyupis a window blur. Any OS-level interaction that swallows thekeyupwithout blurring the browser window strands the held state indefinitely — every subsequentuseKeyHoldread returnstrueuntil the user physically taps and releases that key again.Reproduction
const shift = useKeyHold('Shift').useKeyHold('Shift')is now stuck attrue, even though nothing is held.Other triggers in the same class: Spotlight (Cmd+Space), Mission Control, and various OS shortcuts that consume a modifier
keyupwhile leaving the browser window focused.Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://codesandbox.io/p/sandbox/stoic-fast-h5k2pr
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
No, because I do not have time to dig into it
Terms & Code of Conduct