Repository navigation
feat(hotkeys): Let function and media keys fire in text fields - #299
Conversation
`ignoreInputs: 'auto'` exists so people can type without triggering shortcuts. Function keys and media keys type nothing, so a hotkey on one of them now fires while a text field has focus, with any modifiers. Before, an `F5` or `Shift+F10` hotkey was skipped in a text field and the browser acted on the key instead. Media keys are the keys whose names start with `Audio`, `Browser`, `Launch`, or `Media`. A sequence follows its first step, so a sequence that starts with a function key no longer skips later steps in text fields or widgets. The defaults guide and the `ignoreInputs` JSDoc now warn that Control and Meta chords can replace text editing shortcuts such as `Mod+Z`, and say why `'auto'` does not detect them. The "register several hotkeys" example no longer registers undo and redo beside a textarea.
…sequences The non-typing key pattern matched any name that starts with `F` and a digit, so `F0` or `F25` registered from JavaScript also fired in text fields. It now matches `F1` to `F24` only. A sequence that starts with a function key, such as `['F2', 'R']`, now fires in text fields, and its later keys don't type into the field. The changeset, the defaults guide, and the sequences guides now say so, and a test covers it.
🦋 Changeset detectedLatest commit: 637a2d0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
🚀 Changeset Version Preview1 package(s) bumped directly, 17 bumped as dependents. 🟨 Minor bumps
🟩 Patch bumps
|
@tanstack/alpine-hotkeys
@tanstack/angular-hotkeys
@tanstack/angular-hotkeys-devtools
@tanstack/ember-hotkeys
@tanstack/hotkeys
@tanstack/hotkeys-devtools
@tanstack/lit-hotkeys
@tanstack/octane-hotkeys
@tanstack/preact-hotkeys
@tanstack/preact-hotkeys-devtools
@tanstack/react-hotkeys
@tanstack/react-hotkeys-devtools
@tanstack/solid-hotkeys
@tanstack/solid-hotkeys-devtools
@tanstack/svelte-hotkeys
@tanstack/svelte-hotkeys-devtools
@tanstack/vue-hotkeys
@tanstack/vue-hotkeys-devtools
commit: |
|
🎉 This PR has been released! Thank you for your contribution! |
🎯 Changes
ignoreInputs: 'auto', hotkeys on function keys (F1toF24) and media keys (names that start withAudio,Browser,Launch, orMedia) now fire while a text field or a key-owning widget has focus, with any modifiers. Before, anF5orShift+F10hotkey was skipped in a text field and the browser acted on the key. The rule lives ingetDefaultIgnoreInputsinpackages/hotkeys/src/_registration.ts.['F2', 'R']now also fires in text fields, and its later keys don't type into the field. The changeset, the defaults guide, and every framework's sequences guide say so.ignoreInputsJSDoc now warn that Control and Meta chords can take over text editing shortcuts such asMod+Z, and explain why'auto'doesn't detect them. Quick-start and guide examples that registered undo and redo next to a<textarea>now use otherModchords.[F2]bindings, out-of-range names (F0,F25,Fn,Find), and an F-key sequence typed in an input. An e2e case infocus.spec.tspressesF2,Shift+F10, andMediaPlayPausein text fields in all three engines.Notes
This is a behavior change under the default options, so it ships as a minor. Apps that relied on an F-key hotkey being skipped in text fields can set
ignoreInputs: trueon it.✅ Checklist
pnpm run test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Summary by CodeRabbit
ignoreInputs: trueto keep hotkeys from firing in text fields.