Skip to content
Source
Sign inSign up
TanStack/hotkeys

ignoreInputs treats range, checkbox and radio inputs as text fields, so they swallow all single-key hotkeys #206

Closednikbrunner(GitHub profile, opens in a new tab) opened this issue 1 comment

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:

  1. useHotkey('F', () => console.log('F'))
  2. Render <input type="range" /> and focus it.
  3. 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.

  1. This was fixed in #209 and will be included in the next release, coming soon.

  2. KevinVandy closed this

Sign in to join this conversation.