Skip to content

SequenceManager ignores ignoreInputs (sequences fire while typing in inputs) #34

@cursor

Description

@cursor

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,
})
  1. Focus a text input
  2. Type gr quickly

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions