Skip to content

fix: add ignoreInputs support to SequenceManager and useHotkeySequence #21

Open
kadeangell wants to merge 4 commits intoTanStack:mainfrom
kadeangell:feat-ignore-inputs-in-hotkey-sequences
Open

fix: add ignoreInputs support to SequenceManager and useHotkeySequence #21
kadeangell wants to merge 4 commits intoTanStack:mainfrom
kadeangell:feat-ignore-inputs-in-hotkey-sequences

Conversation

@kadeangell
Copy link

🎯 Changes

Added support for the ignoreInputs flag on the hotkey sequences by adding an #isInputElement method to the SequenceManager class.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

SequenceManager never checked the ignoreInputs option, so keyboard sequences like G+A and G+G would fire even when the user was typing in input, textarea, select, or contentEditable elements.
Two issues were fixed:

1. SequenceManager (#handleKeyDown) now checks ignoreInputs before matching keys. A new #isInputElement() method mirrors the same logic from HotkeyManager. The ignoreInputs default is resolved at registration time using the first step of the sequence — Ctrl/Meta combos and Escape default to false (fire in inputs), while single keys and Shift/Alt combos default to true (ignored in inputs).

2. useHotkeySequence React hook was silently dropping the ignoreInputs option — it only forwarded timeout and platform to manager.register().  Now ignoreInputs is extracted, forwarded, and included in the effect dependency array.

Added tests covering: single-key sequences ignored in input/textarea/ contentEditable by default, Mod sequences firing in inputs by default, explicit ignoreInputs: true/false overrides, and button-type inputs not being treated as text inputs.
@kadeangell kadeangell changed the title Feat ignore inputs in hotkey sequences fix: add ignoreInputs support to SequenceManager and useHotkeySequence Feb 17, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 18, 2026

Open in StackBlitz

npm i https://pkg.pr.new/TanStack/hotkeys/@tanstack/hotkeys@21
npm i https://pkg.pr.new/TanStack/hotkeys/@tanstack/hotkeys-devtools@21
npm i https://pkg.pr.new/TanStack/hotkeys/@tanstack/react-hotkeys@21
npm i https://pkg.pr.new/TanStack/hotkeys/@tanstack/react-hotkeys-devtools@21

commit: 350971b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments