-
-
Notifications
You must be signed in to change notification settings - Fork 31
Description
Bug
SequenceManager.register(..., { ignoreInputs: true }) still matches and fires while the user is typing in an <input>/<textarea>/<select> (and also prevents the final character when preventDefault is enabled).
SequenceOptions extends HotkeyOptions and includes ignoreInputs, so this option looks supported, but SequenceManager never checks it.
Versions
@tanstack/hotkeys: 0.1.3- (via)
@tanstack/react-hotkeys: 0.1.3
Repro
import { getSequenceManager } from "@tanstack/hotkeys"
const seq = getSequenceManager()
seq.register(["G", "R"], () => {
console.log("matched")
}, {
ignoreInputs: true,
timeout: 800,
preventDefault: true,
stopPropagation: true,
})- Focus a text input
- Type
grquickly
Expected
When the key events originate from an input-like element, the sequence should be ignored (no match, no callback, no preventDefault/stopPropagation).
Actual
The sequence matches and fires even while the input is focused. With preventDefault: true, the final key in the sequence is prevented (so the second character does not get typed), and app-level handlers (like route navigation) can trigger unexpectedly.
Root cause
src/sequence.ts does not implement the same input filtering that HotkeyManager has (see src/hotkey-manager.ts / #isInputElement and the ignoreInputs check in #processTargetEvent). SequenceManager’s #handleKeyDown should likely skip processing when options.ignoreInputs !== false and event.target is input-like (and probably should not advance currentIndex either).
Happy to provide a minimal repro repo if helpful.