TanStack Hotkeys version#
@tanstack/hotkeys 0.18.0 (also 0.11.0)
Framework/Library version#
React 19, Base UI Slider
Describe the bug and the steps to reproduce it#
isInputElement returns true for every <input> except button, submit and reset. A focused <input type="range">, checkbox or radio is therefore treated as text entry, and every single-key hotkey with the default ignoreInputs: 'auto' is skipped while it has focus.
This bites with component libraries whose slider thumb focuses a native range input, such as Base UI: after clicking a slider, no single-key shortcut works until focus moves elsewhere.
Since #163, getOwnedKeys already knows which keys these controls use (slider: arrows, Home/End, PageUp/PageDown; checkbox: Space; radio/radiogroup: arrows and Space), but only through the ARIA role attribute, and isInputElement short-circuits before it for native inputs.
Steps:
useHotkey('F', () => console.log('F'))
- Render
<input type="range" /> and focus it.
- Press F.
Actual: nothing happens.
Expected: the hotkey fires. The arrow keys, Home/End and PageUp/PageDown stay with the slider.
Suggested fix: count only text-entry input types (text, search, email, url, tel, password, number, date and time types) in isInputElement, and map range, checkbox and radio to the owned keys of their implicit roles in getOwnedKeys.
Your Minimal, Reproducible Example#
The three steps above; happy to add a sandbox.
Do you intend to try to help solve this bug with your own PR?#
Maybe, I'll see if I can get to it.
This was fixed in #209 and will be included in the next release, coming soon.