From 3339f06c3651c133a2314b979c1d4d3615c43a86 Mon Sep 17 00:00:00 2001 From: Kevin Van Cott Date: Sat, 28 Nov 2026 08:37:51 -0600 Subject: [PATCH 1/3] feat(hotkeys): Follow moved elements and record in other windows Element-targeted hotkeys in React, Octane, Solid and Svelte listen on the element's document, which they found once at registration. A hotkey went quiet after its element moved to another document or shadow root, such as a Solid Portal moving into a Picture-in-Picture window, or after it registered while its element was outside the page. The manager now moves that listener when focus enters the element, and on key presses there, before the press reaches the document. The recorder takes a `target` window or document to record in. Closing that window cancels the recording and releases its held keys, and a closed window doesn't start one. Browser tests cover popups, closed shadow roots and detached containers, and every adapter app now moves an element hotkey into a popup window. --- .changeset/follow-target-document.md | 11 + .changeset/recorder-target-window.md | 5 + .intent/review-state.json | 682 ++++++++++-------- .../alpine/guides/custom-hotkey-recording.md | 3 + .../angular/guides/custom-hotkey-recording.md | 3 + .../ember/guides/custom-hotkey-recording.md | 3 + .../lit/guides/custom-hotkey-recording.md | 3 + .../octane/guides/custom-hotkey-recording.md | 3 + .../preact/guides/custom-hotkey-recording.md | 3 + .../react/guides/custom-hotkey-recording.md | 3 + .../solid/guides/custom-hotkey-recording.md | 3 + .../svelte/guides/custom-hotkey-recording.md | 3 + .../vue/guides/custom-hotkey-recording.md | 3 + docs/reference/classes/HotkeyManager.md | 30 +- docs/reference/classes/HotkeyRecorder.md | 20 +- docs/reference/functions/getHotkeyManager.md | 2 +- .../functions/toHotkeyRegistrationView.md | 2 +- .../interfaces/ActivateHotkeyScopeOptions.md | 6 +- .../interfaces/HotkeyChordOptions.md | 39 +- .../interfaces/HotkeyChordRecorderOptions.md | 36 +- .../interfaces/HotkeyChordRegistration.md | 22 +- .../interfaces/HotkeyChordRegistrationView.md | 20 +- docs/reference/interfaces/HotkeyOptions.md | 37 +- .../interfaces/HotkeyRegistrationHandle.md | 12 +- .../interfaces/HotkeyRegistrationsResult.md | 4 +- .../reference/interfaces/HotkeyScopesState.md | 12 +- .../interfaces/HotkeySequenceOptions.md | 39 +- .../HotkeySequenceRecorderOptions.md | 40 +- .../interfaces/HotkeySequenceRegistration.md | 24 +- .../HotkeySequenceRegistrationView.md | 24 +- .../type-aliases/HotkeyCommonOptions.md | 2 +- .../type-aliases/HotkeyOptionsFor.md | 2 +- .../type-aliases/HotkeyRecorderOptions.md | 2 +- .../type-aliases/HotkeyRegistration.md | 2 +- .../type-aliases/HotkeyRegistrationStatus.md | 2 +- .../type-aliases/HotkeyRegistrationView.md | 2 +- e2e/README.md | 3 + e2e/adapters/adapters.spec.ts | 104 +++ e2e/adapters/apps.ts | 59 +- e2e/adapters/apps/alpine/index.html | 1 + e2e/adapters/apps/alpine/src/main.ts | 7 +- e2e/adapters/apps/angular/src/main.ts | 17 +- .../apps/ember/app/templates/application.gts | 3 + e2e/adapters/apps/lit/src/main.ts | 9 + e2e/adapters/apps/octane/src/main.tsrx | 5 +- e2e/adapters/apps/preact/src/main.tsx | 44 +- e2e/adapters/apps/react/src/main.tsx | 43 +- e2e/adapters/apps/solid/src/main.tsx | 27 +- e2e/adapters/apps/svelte/src/App.svelte | 6 + e2e/adapters/apps/vue/src/App.vue | 3 + e2e/adapters/shared/fixture.ts | 44 +- e2e/browser/other-window.spec.ts | 309 ++++++++ package.json | 6 +- packages/hotkeys/src/_recording-guard.ts | 43 +- packages/hotkeys/src/_target-listeners.ts | 11 + packages/hotkeys/src/hotkey-manager.ts | 88 ++- packages/hotkeys/src/hotkey-recorder.ts | 37 +- .../hotkeys/tests/delegated-handlers.test.ts | 155 +++- .../hotkeys/tests/recorder-window.test.ts | 204 ++++++ .../solid-hotkeys/tests/portal-mount.test.tsx | 56 ++ test-utils/src/conformance/cases/hotkeys.ts | 25 + .../conformance/cases/recorder-hint-format.ts | 19 + 62 files changed, 1913 insertions(+), 524 deletions(-) create mode 100644 .changeset/follow-target-document.md create mode 100644 .changeset/recorder-target-window.md create mode 100644 e2e/browser/other-window.spec.ts create mode 100644 packages/hotkeys/tests/recorder-window.test.ts create mode 100644 packages/solid-hotkeys/tests/portal-mount.test.tsx diff --git a/.changeset/follow-target-document.md b/.changeset/follow-target-document.md new file mode 100644 index 000000000..f6d3d7bfe --- /dev/null +++ b/.changeset/follow-target-document.md @@ -0,0 +1,11 @@ +--- +'@tanstack/hotkeys': patch +--- + +In React, Octane, Solid, and Svelte, an element-targeted hotkey now keeps working when its element moves to another document or shadow root, or is registered before its element is in the page. These adapters listen on the element's document, so that `onKeyDown` handlers run before the hotkey. They found that document once, at registration, so the hotkey went quiet in these cases: + +- An app moves an existing element into a popup or Document Picture-in-Picture window, as a Solid `Portal` does when its `mount` changes. +- An element moves into or out of a shadow root. +- A hotkey registers while its element is in a container that isn't in the page yet. If only the container is attached later, the hotkey fired before handlers on the document, so they couldn't stop it. If the element is moved out of the container, the hotkey never fired. + +The hotkey now moves its listener to the element's current document when focus enters the element, before the next key press there. diff --git a/.changeset/recorder-target-window.md b/.changeset/recorder-target-window.md new file mode 100644 index 000000000..bcd4b752e --- /dev/null +++ b/.changeset/recorder-target-window.md @@ -0,0 +1,5 @@ +--- +'@tanstack/hotkeys': minor +--- + +The recorder has a `target` option: the window to record key presses in, or its document. Pass a Picture-in-Picture window to record a hotkey from a button inside it. Recording listens only in that window, and `cancelOnBlur` cancels when that window loses focus. Closing the window cancels the recording, and a closed window doesn't start one. The option is read when recording starts and defaults to the page's `window`. Every adapter's recorder accepts it. diff --git a/.intent/review-state.json b/.intent/review-state.json index d95615589..f9c644111 100644 --- a/.intent/review-state.json +++ b/.intent/review-state.json @@ -64,16 +64,16 @@ "evidence": ["packages/ember-hotkeys/skills/ember-hotkeys/SKILL.md"] }, "skill:packages/hotkeys/skills/app-hotkeys/SKILL.md": { - "fingerprint": "31c19197baac62ebbe9de02e02143a5b3fe821e4c3112bb4637b5a6f5673354e", + "fingerprint": "83791d578bf1f162126a820b137de75eadfdf55c1b667a2870c382992b7a286f", "snapshot": { "docs/framework/react/guides/app-hotkeys.md": "307e6ced70379adc2abec5094404136c6c68753009605a83d890f1d15af257d9", "docs/framework/react/guides/cheat-sheet-ui-helpers.md": "88c1bb4b24c6c93efb741489fc8d027352c1a2ef33927706fa8e39c7938803a2", - "docs/framework/react/guides/custom-hotkey-recording.md": "250869e7fcbb8af8e78b01538662198a2668151ced170ee37ed881da4a6f0693", + "docs/framework/react/guides/custom-hotkey-recording.md": "b948d7b4d028cd0453f3ea35be7424042dd7e404f6c3c27be9bea118f8275275", "packages/hotkeys/skills/app-hotkeys/SKILL.md": "da21229bee202a356943a92987ab971eb5157d4a51639a48e67122e8c25e6f3c", "packages/hotkeys/skills/app-hotkeys/references/recording.md": "cee8af22374e484878c9f148d4fee911de4239700961ffb8a00880e779aa6f67", "packages/hotkeys/src/app-hotkeys.ts": "4fc089bf6f3f247d8ccd6cc819571d945f45e95271e5169707a6c29d7ec6011f", "packages/hotkeys/src/conflicts.ts": "005f63fdfa139d51203306ef9b3fb83ebf76ddd22553162a5262827a5e9d0921", - "packages/hotkeys/src/hotkey-recorder.ts": "bcb4f1e3940abb28b3611ee59d43c6545489dec15fd02b4d070b06ebd725f4bc", + "packages/hotkeys/src/hotkey-recorder.ts": "89451078c5a2c139c75a730dc44b651e92229595d2956cb96ef1e525bb1de735", "packages/react-hotkeys/tests/skills/shortcut-settings/fixture.tsx": "ecc6155241ebccca4ef4cd76e8925b3abeec73e9d88e6906bdf70e4c604788aa", "packages/react-hotkeys/tests/skills/shortcut-settings/grade.tsx": "c3538737712f00d52a4b6290d078a37f4c4d8881b9ce512f205f9e531b982f5e", "packages/react-hotkeys/tests/skills/shortcut-settings/mistakes/full-list-storage.tsx": "1d40680b6046115e8c7c71f474e3487fc953b82220e0f5809b01f39c0ca12206", @@ -83,13 +83,15 @@ "packages/react-hotkeys/tests/skills/shortcut-settings/solution.tsx": "3441296dea51490188d34991428fe2b8bf11ce6fafbdf6e2f7595ff7082f1400", "packages/react-hotkeys/tests/skills/shortcut-settings/task.md": "7163ed96e6694c745461f0edaf296b353906cfdb868f9c5df7d08ee01a4ba0ea" }, - "head": "95c311c273b9eb8df7854d28123f76b64fef478a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "The skill describes no registration statuses; the changed sources only touch the ARIA formatters and the status comment.", - "evidence": ["packages/hotkeys/skills/app-hotkeys/SKILL.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/framework/react/guides/custom-hotkey-recording.md, packages/hotkeys/src/hotkey-recorder.ts at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "skill:packages/hotkeys/skills/hotkeys-core/SKILL.md": { - "fingerprint": "2082661f12c18305f510c0809ebe52fc47e99e313e8e2b90e0455a431ca02b6d", + "fingerprint": "b2737e75bede6906ccd9a3cc555aba8cdce1003093c6700bad552551f62d9814", "snapshot": { "docs/framework/react/guides/hotkeys-provider-and-scopes.md": "57039ef29571e18c058ea77d104140e33c9b7fbda7de561c4d77247a47a566ce", "docs/framework/react/guides/hotkeys.md": "4f49e8ef1873ac0f85ed63f7c7f3d5fe6d0561b510dbe42c6a593217335ff1db", @@ -98,7 +100,7 @@ "packages/hotkeys/skills/hotkeys-core/SKILL.md": "f7522e6fcc2173cbaf0d6f3293e6e6233d891c3032ec022f8c582997f1a213c8", "packages/hotkeys/skills/hotkeys-core/references/scopes.md": "1ae616ff7ce92d9679bbd0752ada572c2060c33ea7e7e638bfcc9d5425ac6bfa", "packages/hotkeys/skills/hotkeys-core/references/testing.md": "c2957eaac34ca431832069156504cf7434dcb96d5227bcb7cbb2129dc8e979bd", - "packages/hotkeys/src/hotkey-manager.ts": "ebe90882990b299a83201ec93d78b82711ca9b2ecc96924de1cf4701eaa096d1", + "packages/hotkeys/src/hotkey-manager.ts": "37d275dc3e93f968c37d721aee12b19b059fb3b18ffa618ccc0bcfc516d4d89e", "packages/hotkeys/src/match.ts": "d94dfcb1665ef00c77c07972948d482827bb8707c74ebc8bf39246834b548e16", "packages/react-hotkeys/tests/skills/editor-shortcuts/editor-shortcuts.test.tsx": "73411ec7c25652244ed31ad4120880dfc08d6e10af959bef04d2df5360769fde", "packages/react-hotkeys/tests/skills/editor-shortcuts/fixture.tsx": "613a833bb6412b600925deb4009d16cfbfe7afa9a5dc0b82d1a39b8da8c0230b", @@ -110,10 +112,12 @@ "packages/react-hotkeys/tests/skills/editor-shortcuts/solution.tsx": "ec81379bf0e3a9950222cf8525f82f8abefeb6b46339550fd3a8622e61bf4f0d", "packages/react-hotkeys/tests/skills/editor-shortcuts/task.md": "9610d80e7add59f0433cbf210562ff8c481dc2c14371ce31c00a329d9ff1fedf" }, - "head": "f9fc17f0bbb537e70119ec81cec5d3d94294aa8e", - "outcome": "updated", - "reason": "Added the key lock state helper next to the held-key helpers, with its null-until-reported behavior; the testing reference explains faking isTrusted and getModifierState for lock state tests", - "evidence": ["packages/hotkeys/skills/hotkeys-core/references/testing.md"] + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", + "outcome": "no-change", + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: packages/hotkeys/src/hotkey-manager.ts at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "skill:packages/lit-hotkeys/skills/lit-hotkeys/SKILL.md": { "fingerprint": "a496914b60e56de77a476ccaa4667aef730b9c987330015dc20b405ea51deb89", @@ -257,7 +261,7 @@ "evidence": ["packages/vue-hotkeys/skills/vue-hotkeys/SKILL.md"] }, "planning:_artifacts": { - "fingerprint": "89772ef90e5da5297886e3a39521ee83b6ad01c4287f75cdc74d0e06b4aec223", + "fingerprint": "a59d90fa085beaedb379ca7989c412d457ebb6d8d446620978b9f708ebf18d18", "snapshot": { "_artifacts/domain_map.yaml": "9020ca258eebcb3575acad17ed5fc62d53306d6e07d6dc6456c006fd8f05f94b", "_artifacts/skill_spec.md": "f599f1f45212638ba62f1cee4e234e47353b422cec1fec5c525208d23cc52d34", @@ -276,7 +280,7 @@ "docs/framework/preact/quick-start.md": "247a2beda75d6c50bc0345aa8a9ef0a247e588fe8f4cfe7ea7733c6c8c9f15db", "docs/framework/react/guides/app-hotkeys.md": "307e6ced70379adc2abec5094404136c6c68753009605a83d890f1d15af257d9", "docs/framework/react/guides/cheat-sheet-ui-helpers.md": "88c1bb4b24c6c93efb741489fc8d027352c1a2ef33927706fa8e39c7938803a2", - "docs/framework/react/guides/custom-hotkey-recording.md": "250869e7fcbb8af8e78b01538662198a2668151ced170ee37ed881da4a6f0693", + "docs/framework/react/guides/custom-hotkey-recording.md": "b948d7b4d028cd0453f3ea35be7424042dd7e404f6c3c27be9bea118f8275275", "docs/framework/react/guides/hotkeys-provider-and-scopes.md": "57039ef29571e18c058ea77d104140e33c9b7fbda7de561c4d77247a47a566ce", "docs/framework/react/guides/hotkeys.md": "4f49e8ef1873ac0f85ed63f7c7f3d5fe6d0561b510dbe42c6a593217335ff1db", "docs/framework/react/guides/sequences.md": "35a2042e6adb52cca5c10ad36a8cbe65783b38be3383af612f368007a5f4b724", @@ -320,8 +324,8 @@ "packages/hotkeys/skills/hotkeys-core/references/testing.md": "c2957eaac34ca431832069156504cf7434dcb96d5227bcb7cbb2129dc8e979bd", "packages/hotkeys/src/app-hotkeys.ts": "4fc089bf6f3f247d8ccd6cc819571d945f45e95271e5169707a6c29d7ec6011f", "packages/hotkeys/src/conflicts.ts": "005f63fdfa139d51203306ef9b3fb83ebf76ddd22553162a5262827a5e9d0921", - "packages/hotkeys/src/hotkey-manager.ts": "ebe90882990b299a83201ec93d78b82711ca9b2ecc96924de1cf4701eaa096d1", - "packages/hotkeys/src/hotkey-recorder.ts": "bcb4f1e3940abb28b3611ee59d43c6545489dec15fd02b4d070b06ebd725f4bc", + "packages/hotkeys/src/hotkey-manager.ts": "37d275dc3e93f968c37d721aee12b19b059fb3b18ffa618ccc0bcfc516d4d89e", + "packages/hotkeys/src/hotkey-recorder.ts": "89451078c5a2c139c75a730dc44b651e92229595d2956cb96ef1e525bb1de735", "packages/hotkeys/src/match.ts": "d94dfcb1665ef00c77c07972948d482827bb8707c74ebc8bf39246834b548e16", "packages/lit-hotkeys/skills/lit-hotkeys/SKILL.md": "326b0a1ddd9579c65389e755d5a2e0a69512ef7f91aca21bda7db9c0ddb51521", "packages/lit-hotkeys/skills/lit-hotkeys/references/app-hotkeys.md": "3c5b805f628d0b14361e43944283f3b7271362cc5831def6406e677ce21f2678", @@ -388,10 +392,12 @@ "packages/vue-hotkeys/src/useHotkeyRecorder.ts": "f9090de677350d72ae3e1732eab11e5b89b5cf00021f2cc5e88d2fe3f2fb743d", "packages/vue-hotkeys/src/useHotkeys.ts": "a01bedb627cd6cad884cf59b2077c33b34289589e6a101fefb5ca1709dabb668" }, - "head": "f9fc17f0bbb537e70119ec81cec5d3d94294aa8e", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Lock state is part of the existing held-key helper area in every adapter skill; no new skill, domain, or task", - "evidence": ["_artifacts/skill_tree.yaml"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/framework/react/guides/custom-hotkey-recording.md, packages/hotkeys/src/hotkey-manager.ts, packages/hotkeys/src/hotkey-recorder.ts at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:.changeset/intent-skills.md": { "fingerprint": "a3f3a7466ee28fed505a518e9cd18cfda96a2282d207d73317b00d60b4430f62", @@ -646,24 +652,28 @@ ] }, "source:docs/reference/classes/HotkeyManager.md": { - "fingerprint": "3226c84c119da6a5191ae311b8263ad539dc419628b7b3b72def14a50d80ca13", + "fingerprint": "61c3cd3e56dcce863d12b3e6e1286cc2cafe8dd9f341f2f17dbd90c2306c268e", "snapshot": { - "docs/reference/classes/HotkeyManager.md": "3a4c1c77c8902a2854341673dda0dd0de83830730296408b121a6a5797969a2f" + "docs/reference/classes/HotkeyManager.md": "2f6e7df6a2462ce0dd1d5fd1aa8d0c89821a25cb405c048438604a2c15d74b18" }, - "head": "95c311c273b9eb8df7854d28123f76b64fef478a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the ARIA formatter and suspension changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/reference/classes/HotkeyManager.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:docs/reference/functions/getHotkeyManager.md": { - "fingerprint": "31f744e6f9ce9bc76e0a665e6d19bf006c6003a506e247c0ccc83c0ce269e04c", + "fingerprint": "7e75fc80b3f954a9f5489622b9b52674494e77daffe34acf47eb5517035e0868", "snapshot": { - "docs/reference/functions/getHotkeyManager.md": "aae7ff5221fd0b84965c9cb49b8cbb1dc75cb3a6732b5684ecfd12e8fd1bc1f2" + "docs/reference/functions/getHotkeyManager.md": "e0de6593b8d4bd5c8dbaa4f4589c3644949be33dc41059d94d575404faeafca9" }, - "head": "95c311c273b9eb8df7854d28123f76b64fef478a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the ARIA formatter and suspension changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/reference/functions/getHotkeyManager.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:examples/alpine/kitchen-sink/index.html": { "fingerprint": "e576c33ec891eff09138d3a05b3c29fffc60c984b7f4e88a1dca3848a899cdc5", @@ -1196,158 +1206,150 @@ "evidence": ["packages/vue-hotkeys/skills/vue-hotkeys/SKILL.md"] }, "source:docs/reference/functions/toHotkeyRegistrationView.md": { - "fingerprint": "f24c7f6d047b65ac3da233e206cf90111e68aeb9f3ea6d74709ecbae5b3cbbbe", + "fingerprint": "9b9027570727a24bbf017b3e02938381f64262c231fc6837a86c3ed4148b9077", "snapshot": { - "docs/reference/functions/toHotkeyRegistrationView.md": "2255c92a1744c6cfd82e6d0d0cb25ea7f7aab558a30a5ce2a4d3f7b7e99769ac" + "docs/reference/functions/toHotkeyRegistrationView.md": "7c7c10d710354f3d41aa0ee570c7e3f1b1a2fcb145d32c2a90aaaea4cb1a2f2d" }, - "head": "95c311c273b9eb8df7854d28123f76b64fef478a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the ARIA formatter and suspension changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["docs/reference/functions/toHotkeyRegistrationView.md"] }, "source:docs/reference/interfaces/ActivateHotkeyScopeOptions.md": { - "fingerprint": "019c99ba9d30425c11a2597e153457a3a03521cae32204428a7738b2be5b091e", + "fingerprint": "fb78f70479cd11f839d6a518e077419d62499bd3406f55be3708268f3244f0b3", "snapshot": { - "docs/reference/interfaces/ActivateHotkeyScopeOptions.md": "27d2f7b5c5d6991efc3f74730cb56c772b56251a87e335a77df9374940137727" + "docs/reference/interfaces/ActivateHotkeyScopeOptions.md": "5a69f9a1a22416e0b1634eadd61584d44bf11acf243c419ed7d57a2100a0737c" }, - "head": "95c311c273b9eb8df7854d28123f76b64fef478a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the ARIA formatter and suspension changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/reference/interfaces/ActivateHotkeyScopeOptions.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:docs/reference/interfaces/HotkeyChordOptions.md": { - "fingerprint": "f712a1bf4a1dcda09398081f9bc8b9d4470fdbe8ab18c80890cc804166a18524", + "fingerprint": "a0f51e164ae75891dbd6cacce36ebe00cf393b0296f8214a1589af056bafa231", "snapshot": { - "docs/reference/interfaces/HotkeyChordOptions.md": "c5425d8a1b62d8ab04f95e1caf28fd0df71f46495924e1c3b74457a1bf9e1a15" + "docs/reference/interfaces/HotkeyChordOptions.md": "d13739017932d266ef6b037629b7d7945efa65da21b302c46dc1e64a0b62ca9c" }, - "head": "75b6c798a9a07d3f902d5899b5536220ea30ceec", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Docs, tests, and the ignoreInputs auto resolution for function and media keys; the core skill covers the rule.", - "evidence": [ - "hotkeys-core SKILL.md defaults row updated in the same change" - ] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["docs/reference/interfaces/HotkeyChordOptions.md"] }, "source:docs/reference/interfaces/HotkeyChordRegistration.md": { - "fingerprint": "b2c5613910c18cd60e73e6e6b6a449e3e586470e5f6486b42e800117f648b7db", + "fingerprint": "5c0cd2d4baaa0d1bbeefa95e9fd8fb0bb15394ccd75c150dd4ad97ffe5fdc88a", "snapshot": { - "docs/reference/interfaces/HotkeyChordRegistration.md": "f469d312983a02d2ccfbe4973e119eb2389d8b4cc3ded4939199ce88778f1f8a" + "docs/reference/interfaces/HotkeyChordRegistration.md": "b12632a8bbacd4fff663e944e6314ac4ddb0434f3983d741553c26bd8f033873" }, - "head": "75b6c798a9a07d3f902d5899b5536220ea30ceec", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Docs, tests, and the ignoreInputs auto resolution for function and media keys; the core skill covers the rule.", - "evidence": [ - "hotkeys-core SKILL.md defaults row updated in the same change" - ] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["docs/reference/interfaces/HotkeyChordRegistration.md"] }, "source:docs/reference/interfaces/HotkeyChordRegistrationView.md": { - "fingerprint": "2192989cfe86b10a0e01df63a1f616b33dd1e57aa44df476adac9c1e6367f6b1", + "fingerprint": "d7067f4222930d0981cd4645626ca3a895975ced42f53c8f1c0a9ddbffd77684", "snapshot": { - "docs/reference/interfaces/HotkeyChordRegistrationView.md": "eab5f5665ec1224e7f607ac38e459df8260f0bff12c953b8bb66e8486c0d3b0c" + "docs/reference/interfaces/HotkeyChordRegistrationView.md": "e43f1bae67e1690135fd8b7d4580dc5e3d006ed68940d3e63ed87867b71af6fd" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["docs/reference/interfaces/HotkeyChordRegistrationView.md"] }, "source:docs/reference/interfaces/HotkeyOptions.md": { - "fingerprint": "b7ae33e551d92247be58eb3c654eaccfb2157a2cbea83cfc46c95327e4d6710e", + "fingerprint": "b7c833400975fd74f29f48699439be048fe09245fcc97f71deb6d173378d2163", "snapshot": { - "docs/reference/interfaces/HotkeyOptions.md": "b20f3249f832792b4c120172a94aaa6c72b24c62266ea44a9e7cab01089ab3ef" + "docs/reference/interfaces/HotkeyOptions.md": "b404010b44b92033c4b4f833ce7d7d012cc5c510f68b9145fd804dc120c7d174" }, - "head": "75b6c798a9a07d3f902d5899b5536220ea30ceec", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Docs, tests, and the ignoreInputs auto resolution for function and media keys; the core skill covers the rule.", - "evidence": [ - "hotkeys-core SKILL.md defaults row updated in the same change" - ] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["docs/reference/interfaces/HotkeyOptions.md"] }, "source:docs/reference/interfaces/HotkeyRegistrationHandle.md": { - "fingerprint": "1f90c0b60de795c5bfcaea24a22c36b96ec2d2e8a5dd71eb40ba115cb5a8fcfc", + "fingerprint": "2e7e864ac98be46860a749f6d32e1616d90836c45df3857a683dbe3b6d0ff55c", "snapshot": { - "docs/reference/interfaces/HotkeyRegistrationHandle.md": "9fcf0d95725be1733bcfdbb5716676ba348f03a7edb22de485165fb1aeca609d" + "docs/reference/interfaces/HotkeyRegistrationHandle.md": "94c1545833dfff0625aa43dd176e8655f44d5cab26dd1aeaf749380f6857800a" }, - "head": "95c311c273b9eb8df7854d28123f76b64fef478a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the ARIA formatter and suspension changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["docs/reference/interfaces/HotkeyRegistrationHandle.md"] }, "source:docs/reference/interfaces/HotkeyScopesState.md": { - "fingerprint": "bcdbaf9ba98d535d8c153d4d3469b03fb983ee6f830fd51ad6374f12a1615d8e", + "fingerprint": "ca84fb759f6584fac3e8a0f90ffdac3a4f254049ba8d889a0fc65403b0c7db89", "snapshot": { - "docs/reference/interfaces/HotkeyScopesState.md": "f192279133dec0d435ad6f4f912af2e1ce8a0f88fa301cf99c499d98311bfb56" + "docs/reference/interfaces/HotkeyScopesState.md": "c3066a4bff4d2578f52dc457044fee6ccac9d9546838c09e6bb3b962fa248e35" }, - "head": "95c311c273b9eb8df7854d28123f76b64fef478a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the ARIA formatter and suspension changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/reference/interfaces/HotkeyScopesState.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:docs/reference/interfaces/HotkeySequenceOptions.md": { - "fingerprint": "f33b7ae1ffc44e3ed6c2be5be5b80c5804c084ec9604ce746e05c34f63657474", + "fingerprint": "7d111ea38041ca2ac20faca230a4fd60a0cc080162135d04191e96e60769936b", "snapshot": { - "docs/reference/interfaces/HotkeySequenceOptions.md": "681795b952780fc014293a6fa94f6c2fd03c0b09dea5ac07134d32d04bcdbf6f" + "docs/reference/interfaces/HotkeySequenceOptions.md": "d4be09f4cd104d64e43379a7d8fbeb868adc512c0126286e5fee84242ba40ed8" }, - "head": "75b6c798a9a07d3f902d5899b5536220ea30ceec", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Docs, tests, and the ignoreInputs auto resolution for function and media keys; the core skill covers the rule.", - "evidence": [ - "hotkeys-core SKILL.md defaults row updated in the same change" - ] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["docs/reference/interfaces/HotkeySequenceOptions.md"] }, "source:docs/reference/interfaces/HotkeySequenceRegistration.md": { - "fingerprint": "c58ea718fa938c0d20aec8993ec0b385ab13aa5e8091f55df0c11ecc3dc85562", + "fingerprint": "c00193a2f86bc1d95efcf036052a8bd12e9fbf7b086cf87824993c7b8a9a4f81", "snapshot": { - "docs/reference/interfaces/HotkeySequenceRegistration.md": "e72f6691a8442ca60ad101939b28a298773dd22a812d98307c4917c326a9621f" + "docs/reference/interfaces/HotkeySequenceRegistration.md": "29741fba0bf3c8fcccc1f0b18a31fb456523e2c72a3018c66e11a0c23b0546ec" }, - "head": "75b6c798a9a07d3f902d5899b5536220ea30ceec", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Docs, tests, and the ignoreInputs auto resolution for function and media keys; the core skill covers the rule.", - "evidence": [ - "hotkeys-core SKILL.md defaults row updated in the same change" - ] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["docs/reference/interfaces/HotkeySequenceRegistration.md"] }, "source:docs/reference/interfaces/HotkeySequenceRegistrationView.md": { - "fingerprint": "53d0ac314611f0d44afa7d748c9840cb8a06f25ed5076c2b33117d5ae28ed82b", + "fingerprint": "6d9c292ef3625587c11586ff80c81930f6ea54dbbacd4ce74599f12e2a35a41e", "snapshot": { - "docs/reference/interfaces/HotkeySequenceRegistrationView.md": "74a4ddc0062566d9a8c5384e0d121600630ef9aa2f9c97979490d16ae68c6c60" + "docs/reference/interfaces/HotkeySequenceRegistrationView.md": "73b6655398fa493d0231133a854db4f1ee47bd106256c8302e3c862e0e1b5d0d" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": [ + "docs/reference/interfaces/HotkeySequenceRegistrationView.md" + ] }, "source:docs/reference/type-aliases/HotkeyOptionsFor.md": { - "fingerprint": "38950492ef9f3bf113731ae01c658b65f5e7c7184e17bea9fd68230c3ad82525", + "fingerprint": "479ba2029071650e0fe473dd1dae5ae6d3790cdb93fbac8a3fe370c7641274e4", "snapshot": { - "docs/reference/type-aliases/HotkeyOptionsFor.md": "d1f00295b1c298272e1573836c0b9c817b0c151a168578ddd1bcf8ad9912a106" + "docs/reference/type-aliases/HotkeyOptionsFor.md": "c0a74519f7ed6e8478f93064ba67272752eb99e58c21a76e9ec4401f7da18e8a" }, - "head": "75b6c798a9a07d3f902d5899b5536220ea30ceec", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Docs, tests, and the ignoreInputs auto resolution for function and media keys; the core skill covers the rule.", - "evidence": [ - "hotkeys-core SKILL.md defaults row updated in the same change" - ] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["docs/reference/type-aliases/HotkeyOptionsFor.md"] }, "source:docs/reference/type-aliases/HotkeyRegistration.md": { - "fingerprint": "3bd8782d08f8834eba10480d9490763eed620d80c081eb05a346cfe51ac0300d", + "fingerprint": "73bce928f7402a00b0348cd5b8451e0c0281736589fb5704540875faadf8b922", "snapshot": { - "docs/reference/type-aliases/HotkeyRegistration.md": "7b94fa2e2efd832b172ee9fa8e2defb170ea37c40ad55ebf9c5b2f5685c5e2e6" + "docs/reference/type-aliases/HotkeyRegistration.md": "363a72cfc6fd7a2765b1a755c84fb67e9324970d220273642dd5751fbf8e5e99" }, - "head": "75b6c798a9a07d3f902d5899b5536220ea30ceec", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Docs, tests, and the ignoreInputs auto resolution for function and media keys; the core skill covers the rule.", - "evidence": [ - "hotkeys-core SKILL.md defaults row updated in the same change" - ] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["docs/reference/type-aliases/HotkeyRegistration.md"] }, "source:docs/reference/type-aliases/HotkeyRegistrationView.md": { - "fingerprint": "b55f3ff2f061503c9fb2505565c44ea7158365409acbbe933f75c45e86b97793", + "fingerprint": "5eac8581a783bf8447976057dec2a67dbbac31b232f4e32b8526d8872f471589", "snapshot": { - "docs/reference/type-aliases/HotkeyRegistrationView.md": "92bc09a30f19f9b29b443e7bcf01e0ef6c1f8740f4ad8ea78ed27f56e91ade47" + "docs/reference/type-aliases/HotkeyRegistrationView.md": "e3d1fe462774e5646dfa09692d6f87541151d574865f8e03bbfcc670ab23912a" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["docs/reference/type-aliases/HotkeyRegistrationView.md"] }, "source:packages/hotkeys-devtools/src/components/DetailsPanel.tsx": { "fingerprint": "011684afe5907d27165dfb091296b5de70c411f5014df83ef2ea5a6ebb08cc49", @@ -1950,14 +1952,14 @@ "evidence": ["docs/reference/index.md"] }, "source:docs/reference/type-aliases/HotkeyRegistrationStatus.md": { - "fingerprint": "224516b2f9aa1fda4d5ff3723228d8fc539537fd0e4fa24b6291605b419fc89e", + "fingerprint": "2302d75eb1448e37fc9045b1e475e647778d49f8acc178830f5ba3f1599ff0c3", "snapshot": { - "docs/reference/type-aliases/HotkeyRegistrationStatus.md": "ed87d33999dd03c1301f50292c63bf6b1d76108493d8b6fa11a72cc28c8e20af" + "docs/reference/type-aliases/HotkeyRegistrationStatus.md": "3e3e531be4fc5012c42db469708e6ba4e208f023ef3d3c64659c40475cef3b4c" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["docs/reference/type-aliases/HotkeyRegistrationStatus.md"] }, "source:packages/alpine-hotkeys/src/createHotkeyScopesState.ts": { "fingerprint": "efa0da765d7c23fe56e690ebc774b7ea456a343c908ad8239732d0741f3b64a1", @@ -4134,14 +4136,16 @@ ] }, "source:docs/reference/classes/HotkeyRecorder.md": { - "fingerprint": "2400c1b31661d7836eaf3a44250dc39f2f93cbcb7718c56a5bdc8b3823885cb3", + "fingerprint": "8f9d0893a8cf2b5ad24afa972017af52bd98a0f2c6c40293b6680cf84dfb5464", "snapshot": { - "docs/reference/classes/HotkeyRecorder.md": "aab1b03f48127e5cdcf72e591b6ea8ea41166010c489398bf8791310b8b91c72" + "docs/reference/classes/HotkeyRecorder.md": "8a903e602641701b9aa5ab647bbbb27053d94fde390b5389e12724a37288e4d1" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/reference/classes/HotkeyRecorder.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:packages/hotkeys/tests/hotkey-recorder-ssr.test.ts": { "fingerprint": "394b648ffc52be332ca1ab001ee62311b653f8162c126029f9856e8728ebdbc4", @@ -4989,14 +4993,16 @@ "evidence": ["docs/reference/functions/getKeyStateTracker.md"] }, "source:docs/reference/interfaces/HotkeyChordRecorderOptions.md": { - "fingerprint": "58b67699d05176d327b34c83507476486790e02d1b367f1f46399ffd50c8ec73", + "fingerprint": "fd0b2dd8743d343df98a3b70b492d17dc5f9ceeda46337619b88ebc80432d773", "snapshot": { - "docs/reference/interfaces/HotkeyChordRecorderOptions.md": "a6e37c96beb06fd8d0b418c50acc6393da9b873c983c9cd765cdcced60c24898" + "docs/reference/interfaces/HotkeyChordRecorderOptions.md": "9afc5da0751f3c729d059c228f6ca971e8c5197c38032ab1db94d5918465d21c" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/reference/interfaces/HotkeyChordRecorderOptions.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:docs/reference/interfaces/HotkeyChordRecorderValidationContext.md": { "fingerprint": "1c949e0f783c83ba59de744b3e294420fa42279b13670e03a0b1b74e9217f363", @@ -5019,14 +5025,16 @@ "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] }, "source:docs/reference/interfaces/HotkeySequenceRecorderOptions.md": { - "fingerprint": "f82c0755f74935787b22cfbb47183966172a244c7534b523ef89f763cac8fd9a", + "fingerprint": "e79ebec9fb8657dcc26600f3c3234f0ca9086ceca1ff032d0e11713c026d1ce9", "snapshot": { - "docs/reference/interfaces/HotkeySequenceRecorderOptions.md": "d3ee542445905dde4efef722e9acabe04342f284711f9aaca061eb8410b360b1" + "docs/reference/interfaces/HotkeySequenceRecorderOptions.md": "caf50ae4634467d36a2dd2575395f68d0f4a2e8aca954a1f348b3aac023fb747" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/reference/interfaces/HotkeySequenceRecorderOptions.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:docs/reference/interfaces/HotkeySequenceRecorderValidationContext.md": { "fingerprint": "e577ab8c58c0c073803b8cdb161870ae2d991cec8f8e7c46a7e9fafc1327c823", @@ -5089,14 +5097,16 @@ "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] }, "source:docs/reference/type-aliases/HotkeyRecorderOptions.md": { - "fingerprint": "de413fbd14dabf15093f27c68a71c318e7cbdc8dcb9afdac94b50b9b706453b6", + "fingerprint": "d354f9569d4eff602fe328f2c65be227dc2420962af3e77365465a36ee92b59b", "snapshot": { - "docs/reference/type-aliases/HotkeyRecorderOptions.md": "634a20ce976ff6442dd3b4acd5da4b08461b0105f8f16ae1275034a6b31ff533" + "docs/reference/type-aliases/HotkeyRecorderOptions.md": "072cebb839d27dee1d8b7c9407628bc090fdcaa90cb2ed4bbff9a2da3829eb0e" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/reference/type-aliases/HotkeyRecorderOptions.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:docs/reference/type-aliases/HotkeyRecorderValidationContext.md": { "fingerprint": "50277a157515f6d9a5091030abc038486cbc00aa8154f5aea9edf643fcd70cea", @@ -7103,15 +7113,15 @@ "evidence": ["packages/vue-hotkeys/tests/unset-values.test.ts"] }, "source:packages/hotkeys/src/_target-listeners.ts": { - "fingerprint": "dcffc5426be62a365d241e8086ff88f01e259d528a9d7c068325ab097c691424", + "fingerprint": "8a51e16771a1ce1f0315a0f1a5c897086284d5979bcffc72418e9c29eff236e7", "snapshot": { - "packages/hotkeys/src/_target-listeners.ts": "e90902d0fe118d2d112a7dc8319cd0faa198ae700bd9e8b23f54de2b801011aa" + "packages/hotkeys/src/_target-listeners.ts": "39a0ca154b1dc5bfe6907108e1ca1603388b8a3153820eaa41bd033240aea5bc" }, - "head": "8fe3c166293c8a4cc6eb3f6f88bcd044fb726590", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Review follow-ups to the mount guard and React ref targets; no skill guidance changes.", + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", "evidence": [ - "press-start.test.ts and hidden-content.test.tsx regression tests" + "Changed: packages/hotkeys/src/_target-listeners.ts at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" ] }, "source:packages/hotkeys/tests/capture.test.ts": { @@ -7135,14 +7145,16 @@ "evidence": ["packages/hotkeys/tests/key-state-tracker.test.ts"] }, "source:docs/framework/alpine/guides/custom-hotkey-recording.md": { - "fingerprint": "f33a4871aea2cf62b22b851b424770dcf81db3f249e71aa553ef38748423d2c6", + "fingerprint": "8e7a45bc7b88515e187c67c9ee35e9e7efdb25db467b9fb8891536d08073c02d", "snapshot": { - "docs/framework/alpine/guides/custom-hotkey-recording.md": "8d93e699a41554e85295daa8f42fe14b4f1ba906a35b14c2310c1b66b927efa5" + "docs/framework/alpine/guides/custom-hotkey-recording.md": "68441b2cdcbf83556196ad0f4c6d856da204b4bb3d0a6a6f1633f37d305c34ef" }, - "head": "b6df86ecbe091533369f326371ffc01b536bc37a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Wording on how the recorder treats Windows AltGr; skills do not state it.", - "evidence": ["docs/framework/alpine/guides/custom-hotkey-recording.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/framework/alpine/guides/custom-hotkey-recording.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:docs/framework/alpine/guides/sequences.md": { "fingerprint": "bd52ad132e2053a8ff821daf06fa40dbe0f8468aaec9472cfef0a0ce5805bd62", @@ -7327,14 +7339,16 @@ ] }, "source:docs/framework/ember/guides/custom-hotkey-recording.md": { - "fingerprint": "c3333f06e73f612dd943055cfc80be6c08fce51b6feb862db60a7b28c1637710", + "fingerprint": "33fe237a0e9315ffa609d98499e95289090e043bc7a963a88732a0275f9cd01b", "snapshot": { - "docs/framework/ember/guides/custom-hotkey-recording.md": "abfe143814dfc4388ddb993867d5618f8fbd36fb97009f0f9bde2c9dad1ddb2b" + "docs/framework/ember/guides/custom-hotkey-recording.md": "071de7445db797c1caf6e2220d00605ab1796c8274358f4339105fe986f52853" }, - "head": "b6df86ecbe091533369f326371ffc01b536bc37a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Wording on how the recorder treats Windows AltGr; skills do not state it.", - "evidence": ["docs/framework/ember/guides/custom-hotkey-recording.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/framework/ember/guides/custom-hotkey-recording.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:docs/framework/ember/reference/functions/useHotkeyRecorder.md": { "fingerprint": "4c01d74c0ffbb8c81803d1501956d23831ad4973c11675c7bea85328e09a11d3", @@ -7361,14 +7375,16 @@ ] }, "source:docs/framework/lit/guides/custom-hotkey-recording.md": { - "fingerprint": "d4271739a56f6b2418b4380e3e686451081442662bbb919db0708f2458615901", + "fingerprint": "d0a963847539ff87b4c939ac17f0b422f04e742fac736cc2c2ee47fc913eb323", "snapshot": { - "docs/framework/lit/guides/custom-hotkey-recording.md": "ab5b7b7e7ed1d5c39666e43f2fc21f25723bf67a098bbcf419e7a3826fba7331" + "docs/framework/lit/guides/custom-hotkey-recording.md": "28a667509000148238398f23445cd8139cee205f04d1fbc27bdfac544dfe608a" }, - "head": "b6df86ecbe091533369f326371ffc01b536bc37a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Wording on how the recorder treats Windows AltGr; skills do not state it.", - "evidence": ["docs/framework/lit/guides/custom-hotkey-recording.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/framework/lit/guides/custom-hotkey-recording.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:docs/framework/lit/reference/functions/hotkey.md": { "fingerprint": "bc2085b4fe87bd750b8ec98dc1d35361a784ba12a40c3352dfaea3f27519af10", @@ -8214,14 +8230,16 @@ "evidence": ["oxfmt.config.ts", "pnpm format:check passes"] }, "source:e2e/README.md": { - "fingerprint": "aea95f4a468218f55a0f29afc6592e3850bf4637e782ad4dbeba6805e59ebc18", + "fingerprint": "216ee9117d3a9955f34430ae338f2f9f9e8ecf25541e106454b8620df369ef63", "snapshot": { - "e2e/README.md": "507d4b0c3a926df68f16b56ad7be649faba3bd17d03df61e5309fb16272d36ac" + "e2e/README.md": "153b32e72f8a93aed264e3e54ab78c599980c65830489cd0e4ad3a0cd2a29587" }, - "head": "fa5664a5cecd519fc36453981e66c13049959fa4", - "outcome": "out-of-scope", - "reason": "Directive key normalization, its test, and an e2e README note; the Alpine skill does not describe key normalization.", - "evidence": ["e2e/README.md"] + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", + "outcome": "no-change", + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: e2e/README.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:e2e/playwright.ssr.config.ts": { "fingerprint": "8c34f92dda39a8b81205fa9089794964e8adf061907fdd30ba8725cf30e1deca", @@ -11194,15 +11212,15 @@ "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] }, "source:packages/hotkeys/tests/delegated-handlers.test.ts": { - "fingerprint": "8a443555888ab891a1885f42447dd8e4b7245811e3e33a5a9dad369f365ac93a", + "fingerprint": "c50dc8e7d17603c7c8541b84b5a1d0d4ee30424be9cd8f95f5ae1b873e6acd83", "snapshot": { - "packages/hotkeys/tests/delegated-handlers.test.ts": "8b934b5c21b390d0f7e7895d1238aa13dc82a7612ba14f6f1e7fb945a1eace5f" + "packages/hotkeys/tests/delegated-handlers.test.ts": "c63475d8a07b483dc9b7a5a34b6c2d4f7957177f95d88da4a5b3e7be167200f1" }, - "head": "1f0a2c627c4a18f005762600966a81e9b8daef3a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Refactor to shared types and helpers, generated reference docs, and an example type fix; no guidance changes.", + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", "evidence": [ - "Behavior and public names are unchanged; reference docs are regenerated by pnpm generate-docs." + "Changed: packages/hotkeys/tests/delegated-handlers.test.ts at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" ] }, "source:packages/octane-hotkeys/tests/element-order.test.ts": { @@ -11536,14 +11554,16 @@ "evidence": ["packages/hotkeys/tests/physical-key.test.ts"] }, "source:docs/framework/angular/guides/custom-hotkey-recording.md": { - "fingerprint": "3a4cf80ff7c063db1e043b4162b97118b5721ddb4df4cefcda1f18ee2472b368", + "fingerprint": "ebbe22efdafc2ad319af24445611f849f8ffcc77c2b8b17e8c4c4a56a739d288", "snapshot": { - "docs/framework/angular/guides/custom-hotkey-recording.md": "d4a5b58c600a5991577a5e1a3ec328edfba060781e4e9824b73943a93ce963b2" + "docs/framework/angular/guides/custom-hotkey-recording.md": "f72eea948edc0d60ee307caee33c38a63f2601b2966bdbfc9bdf9d7347b2839c" }, - "head": "b6df86ecbe091533369f326371ffc01b536bc37a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Wording on how the recorder treats Windows AltGr; skills do not state it.", - "evidence": ["docs/framework/angular/guides/custom-hotkey-recording.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/framework/angular/guides/custom-hotkey-recording.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:docs/framework/ember/reference/functions/useAppHotkeyList.md": { "fingerprint": "5f75049947abd0007e83d78ffc33f4dcbf4b6b8a374f8243e24946d4e3d1d98d", @@ -11580,14 +11600,16 @@ ] }, "source:docs/framework/octane/guides/custom-hotkey-recording.md": { - "fingerprint": "e12a030655afdef53ee3e0dc4c547b2dad9cef9937b8a8dbf9155c3515c53443", + "fingerprint": "53036c80017961ad0b8b977166b62100e4616acf9517cfd459a5915ae331141b", "snapshot": { - "docs/framework/octane/guides/custom-hotkey-recording.md": "9ca480566f45332b73fc2963bf5e73960dc98e5622a85b97594155f43e016051" + "docs/framework/octane/guides/custom-hotkey-recording.md": "68b7f54d1b186f2e55e1396f1475f0e43e8ace646e49524a6b5197285561ef9b" }, - "head": "b6df86ecbe091533369f326371ffc01b536bc37a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Wording on how the recorder treats Windows AltGr; skills do not state it.", - "evidence": ["docs/framework/octane/guides/custom-hotkey-recording.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/framework/octane/guides/custom-hotkey-recording.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:docs/framework/octane/reference/functions/useAppHotkeyList.md": { "fingerprint": "ff7e221e6129f28058dff7f07a65181459e9c3d92f896c46fe95a1f60911008a", @@ -11626,34 +11648,40 @@ ] }, "source:docs/framework/preact/guides/custom-hotkey-recording.md": { - "fingerprint": "7fe9d04e45b62a0b8ccae678d0eadd4adbf7cad5f58b4b3fd51f1fb71582a0e9", + "fingerprint": "62a1c7af67023f0c24f97afd2ec59e9dc006c00e3144c1820f5780651a01510b", "snapshot": { - "docs/framework/preact/guides/custom-hotkey-recording.md": "faea2d1c6bc3539c65e100949ef655a38409f741c567f4cac3a98d86148bcaa8" + "docs/framework/preact/guides/custom-hotkey-recording.md": "ccb34efdcb4a29fc2115bd62436ea555d87406c6f28761a415d0a2b21acf333b" }, - "head": "b6df86ecbe091533369f326371ffc01b536bc37a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Wording on how the recorder treats Windows AltGr; skills do not state it.", - "evidence": ["docs/framework/preact/guides/custom-hotkey-recording.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/framework/preact/guides/custom-hotkey-recording.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:docs/framework/solid/guides/custom-hotkey-recording.md": { - "fingerprint": "4d1d84b497828fdaedbe760fa6f21661fea9512dac170a31293e059750610cd5", + "fingerprint": "a00686da54d9d4cf62b45823c088b4bd788dd24fbb699e569cfddc0df4c9d8ff", "snapshot": { - "docs/framework/solid/guides/custom-hotkey-recording.md": "82f412fdc343b2dfec05cd82e07f1fd9fcbab2741583128805cf53fec44118be" + "docs/framework/solid/guides/custom-hotkey-recording.md": "6a26133f24c6a47f6c3f4fc649606085df7be8297d8d55caab4fcf01b9d032f3" }, - "head": "b6df86ecbe091533369f326371ffc01b536bc37a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Wording on how the recorder treats Windows AltGr; skills do not state it.", - "evidence": ["docs/framework/solid/guides/custom-hotkey-recording.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/framework/solid/guides/custom-hotkey-recording.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:docs/framework/svelte/guides/custom-hotkey-recording.md": { - "fingerprint": "99bb5931aff6db3ea66255835feb4d807a94a62da891a7a08cf77325b67cb242", + "fingerprint": "1db57776772a7fe4694617645846350ee9a64077a61ecb128aebe7977354ce35", "snapshot": { - "docs/framework/svelte/guides/custom-hotkey-recording.md": "4089f74b6cd12bd976b8bf37a0d0f3522985b8508904079c2569106e9b1eec13" + "docs/framework/svelte/guides/custom-hotkey-recording.md": "e53df6110bd93af1c714f68f23d905220eaee82279a1df8a34d9422b98f7a17c" }, - "head": "b6df86ecbe091533369f326371ffc01b536bc37a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Wording on how the recorder treats Windows AltGr; skills do not state it.", - "evidence": ["docs/framework/svelte/guides/custom-hotkey-recording.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/framework/svelte/guides/custom-hotkey-recording.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:docs/framework/svelte/reference/functions/getAppHotkeyList.md": { "fingerprint": "8fe5e73db20916113f27570e3ddd2015cf4df4fd61e9285f8b2baeb5ad09831c", @@ -11726,14 +11754,16 @@ ] }, "source:docs/framework/vue/guides/custom-hotkey-recording.md": { - "fingerprint": "1c017ed6b99eb83d845722361f6bbf30a23f6aa87a71dae3680a34f4482a74fb", + "fingerprint": "76de9bee3af0ebc7a43cc7d71da3e07263552c897391d91678042945909e388e", "snapshot": { - "docs/framework/vue/guides/custom-hotkey-recording.md": "054b2c643d02a67bc85fc04252137540970acdd55137e1cdf4c783d04725f0e7" + "docs/framework/vue/guides/custom-hotkey-recording.md": "eabcbbf853157d6c6b6bc07415ec7e61bcc8e3229bbc559ad6c4daeb5436b922" }, - "head": "b6df86ecbe091533369f326371ffc01b536bc37a", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Wording on how the recorder treats Windows AltGr; skills do not state it.", - "evidence": ["docs/framework/vue/guides/custom-hotkey-recording.md"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: docs/framework/vue/guides/custom-hotkey-recording.md at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:docs/framework/vue/reference/functions/useAppHotkeyList.md": { "fingerprint": "0df2af88647ddeaac6454bc7f5d408739b4214832ed3b4e59581d64475d1073d", @@ -17878,46 +17908,52 @@ ] }, "source:e2e/adapters/adapters.spec.ts": { - "fingerprint": "52b52954cd36febbbe5fd02d5bb994423ecb5031cb595ba8110c527ac3b2021f", + "fingerprint": "aa10911cbeb79fa48d0decf82929ecede2cb02ccab66b85b006624593ee6916b", "snapshot": { - "e2e/adapters/adapters.spec.ts": "8ca8a28d2b83f064e914a99216c40cb8decc2379edfb536f963e5524e5a3f174" + "e2e/adapters/adapters.spec.ts": "e05594512ee9553251fbdc4c6f60576417e6084fe741a696f9be8a5456a4f197" }, - "head": "f9fc17f0bbb537e70119ec81cec5d3d94294aa8e", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Covered by the key lock state rows added to each adapter skill and the core testing reference; no further guidance change", - "evidence": ["e2e/adapters/adapters.spec.ts"] + "reason": "Browser and adapter tests for hotkeys whose element moves to another window; no guidance changes", + "evidence": [ + "Changed: e2e/adapters/adapters.spec.ts at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:e2e/adapters/apps.ts": { - "fingerprint": "adafd06c5380836f0837f4e424c15cccabb615aac05198e290f84dd2d8d52240", + "fingerprint": "37c7fb10245fe9fac562b4cd72669c83cdabad0a182b996ae37176805c265a00", "snapshot": { - "e2e/adapters/apps.ts": "4ddd98bb54e7b6181be4c1f1e0d282bf35a30330473b7e96869317a1d7812e64" + "e2e/adapters/apps.ts": "69e903855c3d2e81fe0654af9bb6975f8a6d7491d0bd04d983c3861b01a4b899" }, - "head": "49fc872fffa19d2a83a9e8a70ba02254b5290f5e", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Removed private tracker IDs from test names, comments and test docs; the known-bug skip convention now names a GitHub issue. No guidance change", + "reason": "Browser and adapter tests for hotkeys whose element moves to another window; no guidance changes", "evidence": [ - "Changed: e2e/adapters/apps.ts at 49fc872fffa19d2a83a9e8a70ba02254b5290f5e" + "Changed: e2e/adapters/apps.ts at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" ] }, "source:e2e/adapters/apps/alpine/index.html": { - "fingerprint": "849878bd30be85a786087eee1478eaca229672d5a55d7523df57068790fdbd5d", + "fingerprint": "758c01fa2f49280852fb6247638feb9faccfa02f7fb592e18c3ad1d95708da43", "snapshot": { - "e2e/adapters/apps/alpine/index.html": "9f30a2236c9f2cbfd34f980724fdf31f0c006a1fd5b0374941e252b06df50fc3" + "e2e/adapters/apps/alpine/index.html": "181855b35fa8a4283f39e06c08251008587459afc458cf87b36d34a0ba9b4e02" }, - "head": "f9fc17f0bbb537e70119ec81cec5d3d94294aa8e", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Review fixes: one store publish per event, unfocused mouse events ignored, wording; the skill guidance still matches", - "evidence": ["e2e/adapters/apps/alpine/index.html"] + "reason": "Browser and adapter tests for hotkeys whose element moves to another window; no guidance changes", + "evidence": [ + "Changed: e2e/adapters/apps/alpine/index.html at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:e2e/adapters/apps/alpine/src/main.ts": { - "fingerprint": "905aa84a488d6755fceaa2b2fe632db6d8c74f3d9bb2a52a84404cd4447cff57", + "fingerprint": "57193cc116df3bf0957c8a9cafd248e5fc9887c3785a6748d0562378e4c48f9f", "snapshot": { - "e2e/adapters/apps/alpine/src/main.ts": "c3cfb729aee6c904b81e4e0358c171e2f549d49ca5b0acfa278b65fe20d1e77d" + "e2e/adapters/apps/alpine/src/main.ts": "bd96b09f8220407f7bdbb6cb8bb3527efdd56dacb30e6e03da7bfc17cf6df587" }, - "head": "f9fc17f0bbb537e70119ec81cec5d3d94294aa8e", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Covered by the key lock state rows added to each adapter skill and the core testing reference; no further guidance change", - "evidence": ["e2e/adapters/apps/alpine/src/main.ts"] + "reason": "Browser and adapter tests for hotkeys whose element moves to another window; no guidance changes", + "evidence": [ + "Changed: e2e/adapters/apps/alpine/src/main.ts at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:e2e/adapters/apps/alpine/vite.config.ts": { "fingerprint": "812c2b3ee26bcd9d2edd12e888acb5dd11475ff31a4976dc132eedfdefd6b276", @@ -17944,14 +17980,16 @@ ] }, "source:e2e/adapters/apps/angular/src/main.ts": { - "fingerprint": "136bd94707024923e9096d0ebd606b3a2ca9f33bb9dd371df9631cf620c71534", + "fingerprint": "93dea652e955fe4a4f8ad6f35b1e27f2f61247cd5171c0fcf5f03d03b70848f2", "snapshot": { - "e2e/adapters/apps/angular/src/main.ts": "38b09509059e1355fb8a2d4c02bc5330b23967ea4aebb77ce8c41e51864b01f0" + "e2e/adapters/apps/angular/src/main.ts": "e1ab0cc2fc7f6f9d7bba9e0904f990e99439fcee9bc6585187b5b2b0026b7dc8" }, - "head": "f9fc17f0bbb537e70119ec81cec5d3d94294aa8e", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Covered by the key lock state rows added to each adapter skill and the core testing reference; no further guidance change", - "evidence": ["e2e/adapters/apps/angular/src/main.ts"] + "reason": "Browser and adapter tests for hotkeys whose element moves to another window; no guidance changes", + "evidence": [ + "Changed: e2e/adapters/apps/angular/src/main.ts at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:e2e/adapters/apps/angular/vite.config.ts": { "fingerprint": "784b8eb5334ccd515ea1bd621023924d6fa88ad7c8d101e72e49fc619fc91a7f", @@ -18002,14 +18040,16 @@ ] }, "source:e2e/adapters/apps/ember/app/templates/application.gts": { - "fingerprint": "7fc46f0b7d2364c4716d65a18744d5de0fce1835630d111cfcda7fafc8001d4f", + "fingerprint": "30e5aecd3612c762374ae9f38f1668ea88d9a76626b2b6f0a7ab5e6ce7446d7e", "snapshot": { - "e2e/adapters/apps/ember/app/templates/application.gts": "65883209ce9979a2b2283b003ad09192aa5421d0d92f5d508165cdc40aafaba5" + "e2e/adapters/apps/ember/app/templates/application.gts": "32d8844a54a9577a373301532e447abec7a310e1e09fe58cf8bc1d8214d7fe32" }, - "head": "f9fc17f0bbb537e70119ec81cec5d3d94294aa8e", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Covered by the key lock state rows added to each adapter skill and the core testing reference; no further guidance change", - "evidence": ["e2e/adapters/apps/ember/app/templates/application.gts"] + "reason": "Browser and adapter tests for hotkeys whose element moves to another window; no guidance changes", + "evidence": [ + "Changed: e2e/adapters/apps/ember/app/templates/application.gts at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:e2e/adapters/apps/ember/babel.config.js": { "fingerprint": "1763e9b651c303c561b662d431ef98f0e81a6d8845d0d0a7615c54b201af75de", @@ -18060,14 +18100,16 @@ ] }, "source:e2e/adapters/apps/lit/src/main.ts": { - "fingerprint": "47c02e61fee9fac17272db671616589a6354376ba71706bcab6427ef2ec43867", + "fingerprint": "053b9adab58fe3545260272dfb6716ab641ffe19ead4939c237d36cc8c224a50", "snapshot": { - "e2e/adapters/apps/lit/src/main.ts": "1888bc3c29145bd82aadaef77c747f582965cc73ec27940f4cae5f53edca19d9" + "e2e/adapters/apps/lit/src/main.ts": "ab2a52ef01171e799642fec3aa7bcad08e34f8c53a6bed2b67b19423b12d206d" }, - "head": "f9fc17f0bbb537e70119ec81cec5d3d94294aa8e", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Review fixes: one store publish per event, unfocused mouse events ignored, wording; the skill guidance still matches", - "evidence": ["e2e/adapters/apps/lit/src/main.ts"] + "reason": "Browser and adapter tests for hotkeys whose element moves to another window; no guidance changes", + "evidence": [ + "Changed: e2e/adapters/apps/lit/src/main.ts at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:e2e/adapters/apps/lit/vite.config.ts": { "fingerprint": "f3d3b5fcb9e868cf94b3b638ea28c59f853f5c3b7dce04fd1cec9b09605cdc0f", @@ -18094,14 +18136,16 @@ ] }, "source:e2e/adapters/apps/octane/src/main.tsrx": { - "fingerprint": "472dad6c1c2b8ecd56c2877e0e33aa4513cfcea11b51f54374e94049efedab16", + "fingerprint": "d1951c3125f015dd71bbb8aed20bc00331cc0cbc249dab6f8fbe8a5f412be506", "snapshot": { - "e2e/adapters/apps/octane/src/main.tsrx": "84e891cd08c666b6ea77137ca92a2f4f43e3801bcb5407382fd96b631160ce3e" + "e2e/adapters/apps/octane/src/main.tsrx": "51a45f5403a6027c9dca772b08a04c9b0353d4ab3c3e82789c7e2921196bd20b" }, - "head": "f9fc17f0bbb537e70119ec81cec5d3d94294aa8e", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Covered by the key lock state rows added to each adapter skill and the core testing reference; no further guidance change", - "evidence": ["e2e/adapters/apps/octane/src/main.tsrx"] + "reason": "Browser and adapter tests for hotkeys whose element moves to another window; no guidance changes", + "evidence": [ + "Changed: e2e/adapters/apps/octane/src/main.tsrx at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:e2e/adapters/apps/octane/vite.config.ts": { "fingerprint": "398c42206a3d5932dbc8505cc36abcf28afe79c60100f8dabab5e6ec4d71aae7", @@ -18128,14 +18172,16 @@ ] }, "source:e2e/adapters/apps/preact/src/main.tsx": { - "fingerprint": "4a574cf96ad34ab9c3fa2398145706ff92e6003dee60420b8adef9ae12524c49", + "fingerprint": "44750b5e77d20706f47e0481d5b97b3dae400581e8b352238e4ef0e609aab6e9", "snapshot": { - "e2e/adapters/apps/preact/src/main.tsx": "07f9506bf89fc51748f5e344c85c926f398edaecaa028c904ce53f63757e4b52" + "e2e/adapters/apps/preact/src/main.tsx": "98a5c2ffc9d9c62321504da77ecf28a22a1ff517534ad4664929173c66a38d6b" }, - "head": "f9fc17f0bbb537e70119ec81cec5d3d94294aa8e", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Review fixes: one store publish per event, unfocused mouse events ignored, wording; the skill guidance still matches", - "evidence": ["e2e/adapters/apps/preact/src/main.tsx"] + "reason": "Browser and adapter tests for hotkeys whose element moves to another window; no guidance changes", + "evidence": [ + "Changed: e2e/adapters/apps/preact/src/main.tsx at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:e2e/adapters/apps/preact/vite.config.ts": { "fingerprint": "e83a8d72b4aa0dbf1f51f1bb744c1d17a179554f7f66ea57a7206f0f52b19180", @@ -18162,14 +18208,16 @@ ] }, "source:e2e/adapters/apps/react/src/main.tsx": { - "fingerprint": "0745eaa17ede4a507ebd24d68ffe0bb9454876a8fe42b5d6db01ccd6517087b8", + "fingerprint": "a00da3b5b1363acf23cf7e14fef59594423bbc52798f356d35d88406ab98c210", "snapshot": { - "e2e/adapters/apps/react/src/main.tsx": "4f8eaa2ae71f91b3a5e15b896e2c803ae2349918ec33fdf0caca47b729bd4777" + "e2e/adapters/apps/react/src/main.tsx": "34d86bda4a43368ad30c22c66d6e70cc5a21ff6b846ecba2b02695bad87dce5c" }, - "head": "f9fc17f0bbb537e70119ec81cec5d3d94294aa8e", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Review fixes: one store publish per event, unfocused mouse events ignored, wording; the skill guidance still matches", - "evidence": ["e2e/adapters/apps/react/src/main.tsx"] + "reason": "Browser and adapter tests for hotkeys whose element moves to another window; no guidance changes", + "evidence": [ + "Changed: e2e/adapters/apps/react/src/main.tsx at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:e2e/adapters/apps/react/vite.config.ts": { "fingerprint": "e75ceff92f0e98a0f4674517abf6afdda4ce8dfe4a92640551d3f254d28cd459", @@ -18196,14 +18244,16 @@ ] }, "source:e2e/adapters/apps/solid/src/main.tsx": { - "fingerprint": "999f5797110c89b96a8c4e85031d3315b9181d51e074939bf96922afe5a46d65", + "fingerprint": "564a0d2e2bedcbd8613831ec125f8cea0ef1d558fb1ada4aa8364da6779c4a5e", "snapshot": { - "e2e/adapters/apps/solid/src/main.tsx": "601108eba6fe745bfc69e837afa8ee644aa83f333c94a620194645847c8fd257" + "e2e/adapters/apps/solid/src/main.tsx": "c9be1846366eacfcbca1a6781a9dda7f70aa92df0e089189c3f1b5333530a8fc" }, - "head": "f9fc17f0bbb537e70119ec81cec5d3d94294aa8e", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Review fixes: one store publish per event, unfocused mouse events ignored, wording; the skill guidance still matches", - "evidence": ["e2e/adapters/apps/solid/src/main.tsx"] + "reason": "Browser and adapter tests for hotkeys whose element moves to another window; no guidance changes", + "evidence": [ + "Changed: e2e/adapters/apps/solid/src/main.tsx at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:e2e/adapters/apps/solid/vite.config.ts": { "fingerprint": "fe7a2c3ba69a237e45cc79cde77daf7a78f0e38e1ab1e5b0e1f42599017895c2", @@ -18228,14 +18278,16 @@ ] }, "source:e2e/adapters/apps/svelte/src/App.svelte": { - "fingerprint": "812afd2d9ea67eb847fba7ffa56485a9ba08c452001918c4ac22b5cfa94fbe8e", + "fingerprint": "2220ee61ffbbaafebdd9a9522edfc26b69055f608c044d96997c10f7081b56e0", "snapshot": { - "e2e/adapters/apps/svelte/src/App.svelte": "6181be78c5c8858246c0a3013f80bd86b5599459c77068695778fc91821f6a3b" + "e2e/adapters/apps/svelte/src/App.svelte": "e7bb1d84db3207e87875db1559e13f1b138e9910096d0f2cb4bba298d2a7a5ba" }, - "head": "f9fc17f0bbb537e70119ec81cec5d3d94294aa8e", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Review fixes: one store publish per event, unfocused mouse events ignored, wording; the skill guidance still matches", - "evidence": ["e2e/adapters/apps/svelte/src/App.svelte"] + "reason": "Browser and adapter tests for hotkeys whose element moves to another window; no guidance changes", + "evidence": [ + "Changed: e2e/adapters/apps/svelte/src/App.svelte at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:e2e/adapters/apps/svelte/src/HotkeyHost.svelte": { "fingerprint": "53254a6edb6f35e2911931138dd1554e9ee57d450b42611acab19b9322b48430", @@ -18298,14 +18350,16 @@ ] }, "source:e2e/adapters/apps/vue/src/App.vue": { - "fingerprint": "22a6da02ab95f7e8b85f52c558ef15c02fae225f54522f3773088d976f74eeab", + "fingerprint": "ab1efb2a33149dd64cec2ae9a18d705758d082dd910b8f7851f75d1d30186d55", "snapshot": { - "e2e/adapters/apps/vue/src/App.vue": "0d21c27478e07783b2fe3635cf676441dbd33e69a673c850a49cd085275562d6" + "e2e/adapters/apps/vue/src/App.vue": "7205c144ddcf7831b183b76c70cce3f57df06abf01e80af6333b833fd0198e49" }, - "head": "f9fc17f0bbb537e70119ec81cec5d3d94294aa8e", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Review fixes: one store publish per event, unfocused mouse events ignored, wording; the skill guidance still matches", - "evidence": ["e2e/adapters/apps/vue/src/App.vue"] + "reason": "Browser and adapter tests for hotkeys whose element moves to another window; no guidance changes", + "evidence": [ + "Changed: e2e/adapters/apps/vue/src/App.vue at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:e2e/adapters/apps/vue/src/HotkeyHost.vue": { "fingerprint": "6e4644e06562f6abdfbbeaffc00fffa0f6b6376f5e1cd0095e4860f94d9dc0fc", @@ -18344,15 +18398,15 @@ ] }, "source:e2e/adapters/shared/fixture.ts": { - "fingerprint": "aab2c6e40ab5e62ecaa68dfd387dd0805c973674a9d232b4c0bb05db7bf181a0", + "fingerprint": "b908ed0e7f04b516686990f392437437b9566e8f38427d23250d7492a9d8bfaf", "snapshot": { - "e2e/adapters/shared/fixture.ts": "ba86d58f768bf7f50715e7fdc58c44ba7cc217d712221d14bbd844bd086289e9" + "e2e/adapters/shared/fixture.ts": "00447be1cbbc9d866c007d167245a794ac54d4136fe71a9c49f7b572a77777cd" }, - "head": "ce272666d8aae7bebafc02b184b29fcd2e853125", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Combined test-coverage branch: tests, test setup, e2e suites, CI workflows and tooling config only. Regenerated reference pages only reorder a union type or change a node_modules path. No API or guidance change.", + "reason": "Browser and adapter tests for hotkeys whose element moves to another window; no guidance changes", "evidence": [ - "Changed: e2e/adapters/shared/fixture.ts at ce272666d8aae7bebafc02b184b29fcd2e853125" + "Changed: e2e/adapters/shared/fixture.ts at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" ] }, "source:e2e/browser/sequences-and-scopes.spec.ts": { @@ -19196,16 +19250,14 @@ ] }, "source:test-utils/src/conformance/cases/hotkeys.ts": { - "fingerprint": "f425df7536f860bcd7a7a5786abb8c7c8254ac60b9b19f014719331d1476b221", + "fingerprint": "e85b621df76d0a8d2bb2ab39540d4ca738cd4e8ad6739b931f98436bf8740c75", "snapshot": { - "test-utils/src/conformance/cases/hotkeys.ts": "be66f3efbf78f7258415928c1d012fc14c37445cd33fafa4a3ba4d353d2c90cd" + "test-utils/src/conformance/cases/hotkeys.ts": "5df91797fc6cf0035f4961a1a5c054a10c4afa16c2daf2cb229199c086ad55b5" }, - "head": "8fe6e81b5696979beb1c663ce4aac6c7d6696b77", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Shared adapter conformance suite: test-utils cases and per-adapter test harnesses only; no API or guidance change.", - "evidence": [ - "Changed: test-utils/src/conformance/cases/hotkeys.ts at 8fe6e81b5696979beb1c663ce4aac6c7d6696b77" - ] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["test-utils/src/conformance/cases/hotkeys.ts"] }, "source:test-utils/src/conformance/cases/provider.ts": { "fingerprint": "9e4c80644ec59c9e30f4c10a3a44865d053c17c34d6b4d4231ca249283231a6d", @@ -19218,13 +19270,13 @@ "evidence": ["test-utils/src/conformance/cases/provider.ts"] }, "source:test-utils/src/conformance/cases/recorder-hint-format.ts": { - "fingerprint": "cdc0ac4b9990c5ce9635f830d59ac9c91232700f42f70b8161f561556629bab6", + "fingerprint": "40c1473bc68e35606f0b2e80ff4b69962b09c81f859ea8c880526ef72ba391f0", "snapshot": { - "test-utils/src/conformance/cases/recorder-hint-format.ts": "c4ef2ad708289b690037838e08f50fb3b73abcc491d6afad639d1dcbfc0138e0" + "test-utils/src/conformance/cases/recorder-hint-format.ts": "92e5bb060dbcc9cfc2db0cda4b5bdc4a7ffcae0e2149a5a9abd1fe5801be3d00" }, - "head": "6f837e4d688f72b762181737c4589fbde7606b36", - "outcome": "out-of-scope", - "reason": "Test change; it describes no library behavior the guidance covers.", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", + "outcome": "no-change", + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", "evidence": ["test-utils/src/conformance/cases/recorder-hint-format.ts"] }, "source:test-utils/src/conformance/cases/registrations.ts": { @@ -20923,14 +20975,14 @@ "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] }, "source:docs/reference/interfaces/HotkeyRegistrationsResult.md": { - "fingerprint": "ff6392c2f03f62ba975264d6ab2c09a2f42471ed6ba260aa3f5663a8a11b5ca9", + "fingerprint": "dd82d065846f7d94d51ceb8546e81996ee2e10dc1a94d2c6a58fe4ff5cacd57a", "snapshot": { - "docs/reference/interfaces/HotkeyRegistrationsResult.md": "96b2c82c28c983cf735346b3e5e83e7017a11ab94b0beac31077f45ff322fc2f" + "docs/reference/interfaces/HotkeyRegistrationsResult.md": "5f30aafb6c67cab7f53518f6003aca3bbef3d211f76d503c3568695690b1b5b1" }, - "head": "cd1c66aab538ccac294e72ee36ae4466fa9b2d2b", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Regenerated reference page. The skills cover the formatForAria, createFormatter, and suspendCharacterKeys API changes.", - "evidence": ["packages/hotkeys/skills/hotkeys-core/SKILL.md"] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["docs/reference/interfaces/HotkeyRegistrationsResult.md"] }, "source:docs/reference/interfaces/KeyIdentity.md": { "fingerprint": "46885e2ce6f4b0697372e058a902f4df9526f7a9c0141ea4a5c48ce2996ae2d2", @@ -20943,16 +20995,14 @@ "evidence": ["No skill references this file"] }, "source:docs/reference/type-aliases/HotkeyCommonOptions.md": { - "fingerprint": "bd874701c792556376995aa0f0077363f239b44fa3fc3f77334c4ae4d10f8d72", + "fingerprint": "2ea9bb6df39f64b52eef15bf1c552fad877c54f2d535f30cfdefec4cd48f3ab1", "snapshot": { - "docs/reference/type-aliases/HotkeyCommonOptions.md": "36258311e6d189878822ed88e11af2d3dd7051e12adebcf728d50cb06e93211f" + "docs/reference/type-aliases/HotkeyCommonOptions.md": "72bf46f0972176229761ffe1d59b2b0d544fb74dfc3c1f703a082997e864573f" }, - "head": "75b6c798a9a07d3f902d5899b5536220ea30ceec", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Docs, tests, and the ignoreInputs auto resolution for function and media keys; the core skill covers the rule.", - "evidence": [ - "hotkeys-core SKILL.md defaults row updated in the same change" - ] + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["docs/reference/type-aliases/HotkeyCommonOptions.md"] }, "source:docs/reference/type-aliases/HotkeyEventType.md": { "fingerprint": "77566ac36b19334c8808de76cdad5afd1e02377a468ea87daf2c01d2e4aac4fe", @@ -23467,14 +23517,16 @@ "evidence": ["examples/*/*Recorder*"] }, "source:packages/hotkeys/src/_recording-guard.ts": { - "fingerprint": "5f47a6caa01f46d6bb86b0cbea929d6ad813c11a20e390ae7e404cdf17f29d30", + "fingerprint": "2a57c925e1cdfa9e9601b240f1d1e7b407a5cc4687d83e725815d5a57ed670d0", "snapshot": { - "packages/hotkeys/src/_recording-guard.ts": "0f86e070255f5bc6d7e7eeaffbf8de593aea2bca7b010358ce1b5a60b4f207be" + "packages/hotkeys/src/_recording-guard.ts": "4944513e51eef4004674279d860da3e28fa4ad50414b54ed2aa360223520f76f" }, - "head": "e9031094e0b830b2af9d82d6ae8b24d36ac207d9", + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", "outcome": "no-change", - "reason": "Recording guard: held repeats of a recorded press stay suppressed for hotkeys; no skill guidance changes.", - "evidence": ["hotkey-recorder.test.ts"] + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: packages/hotkeys/src/_recording-guard.ts at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] }, "source:packages/hotkeys/tests/invariants/recorder-layouts.test.ts": { "fingerprint": "2c0722586f2b3d99f639c25d1c513d30dddb3bc71bcd8e4c3eb32898285fbb04", @@ -25559,6 +25611,40 @@ "outcome": "no-change", "reason": "Review fixes: one store publish per event, unfocused mouse events ignored, wording; the skill guidance still matches", "evidence": ["test-utils/src/key-locks.ts"] + }, + "source:packages/hotkeys/tests/recorder-window.test.ts": { + "fingerprint": "dc95aeca6e926fb58af67cffb0b7b46581726f361883ec2f58c50685a4d22a02", + "snapshot": { + "packages/hotkeys/tests/recorder-window.test.ts": "383260d32e6dab48ead374983c344166bd7e1379c1231e416966414b0b9631d4" + }, + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", + "outcome": "no-change", + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: packages/hotkeys/tests/recorder-window.test.ts at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] + }, + "source:packages/solid-hotkeys/tests/portal-mount.test.tsx": { + "fingerprint": "84992ab90725823f23352db1cbfe9629da8b2499e116a6dfe80e2033b6f4d6fe", + "snapshot": { + "packages/solid-hotkeys/tests/portal-mount.test.tsx": "1b14e3608294a44df1cacecb89696a8c976bdba9f748f7b824e79c9955f7e6bf" + }, + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", + "outcome": "no-change", + "reason": "Docs, generated reference, or tests for the element-follow fix and the recorder target option. The skills that cover them were reviewed without changes.", + "evidence": ["packages/solid-hotkeys/tests/portal-mount.test.tsx"] + }, + "source:e2e/browser/other-window.spec.ts": { + "fingerprint": "ad92630c83dea20800036d2f30636d6642dafa396ff41efa164e4aab55d12c36", + "snapshot": { + "e2e/browser/other-window.spec.ts": "c5eee3a9ef38190fc4c468369cfb1aaf6e2e939e3b8043487c7390e7f575a156" + }, + "head": "a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a", + "outcome": "no-change", + "reason": "Recorder target now cancels when its window closes; element hotkeys follow their element on focus. Skills don't cover the recorder target or listener placement, so no guidance changes", + "evidence": [ + "Changed: e2e/browser/other-window.spec.ts at a3fc3ae3a058631dfe821a04edf4cf0cce49fb0a" + ] } } } diff --git a/docs/framework/alpine/guides/custom-hotkey-recording.md b/docs/framework/alpine/guides/custom-hotkey-recording.md index 0a4b55fd4..713481fc3 100644 --- a/docs/framework/alpine/guides/custom-hotkey-recording.md +++ b/docs/framework/alpine/guides/custom-hotkey-recording.md @@ -134,6 +134,8 @@ Options can also be a getter, such as `createHotkeyRecorder(this.hotkeys, () => The recorder also cancels and calls `onCancel` when the window loses focus, such as when the user switches apps or tabs, opens browser devtools, or clicks into an iframe. Set `cancelOnBlur: false` to keep recording. While debugging with devtools open, Chrome's **Rendering > Emulate a focused page** setting keeps the page focused. +To record in another window, such as a Picture-in-Picture window that holds the recorder's button, pass that window or its document as `target`. The recorder reads `target` when recording starts, listens only in that window, and cancels when that window loses focus or closes. A closed window doesn't start recording. + A click elsewhere on the page doesn't cancel, because the recorder doesn't know which element is your recorder. To cancel on a click outside it, use Alpine's `.outside` modifier on `pointerdown`. Don't rely on the button's `blur` event: Safari and Firefox on macOS don't focus a button when it is clicked. ```html @@ -315,6 +317,7 @@ Alpine.data('shortcutSettings', () => { | `onRecord` | Required | Called with the recorded hotkey when a recording commits, and with the same context as `validate` | | `onCancel` | None | Called when the user presses Escape, Tab, or Shift+Tab, when the window loses focus, or when you call `cancelRecording()` | | `cancelOnBlur` | `true` | Cancels the recording when the window loses focus. Set `false` to keep recording. | +| `target` | `window` | The window, or its document, to record in, such as a Picture-in-Picture window. | | `onClear` | None | Called when the user presses Backspace or Delete with nothing recorded | | `maxSteps` | `1` | `1` records a chord. `Infinity` records a sequence. | | `commitKeys` | `'enter'` | With `maxSteps: Infinity`, whether plain Enter commits (`'enter'`) or records as a step (`'none'`) | diff --git a/docs/framework/angular/guides/custom-hotkey-recording.md b/docs/framework/angular/guides/custom-hotkey-recording.md index 2b4e5f91f..7feda68ca 100644 --- a/docs/framework/angular/guides/custom-hotkey-recording.md +++ b/docs/framework/angular/guides/custom-hotkey-recording.md @@ -100,6 +100,8 @@ Options can also be a getter, such as `injectHotkeyRecorder(() => ({ maxSteps: I The recorder also cancels and calls `onCancel` when the window loses focus, such as when the user switches apps or tabs, opens browser devtools, or clicks into an iframe. Set `cancelOnBlur: false` to keep recording. While debugging with devtools open, Chrome's **Rendering > Emulate a focused page** setting keeps the page focused. +To record in another window, such as a Picture-in-Picture window that holds the recorder's button, pass that window or its document as `target`. The recorder reads `target` when recording starts, listens only in that window, and cancels when that window loses focus or closes. A closed window doesn't start recording. + A click elsewhere on the page doesn't cancel, because the recorder doesn't know which element is your recorder. To cancel on a click outside it, listen for `pointerdown` while recording. Don't rely on the button's `blur` event: Safari and Firefox on macOS don't focus a button when it is clicked. ```ts @@ -291,6 +293,7 @@ export class ShortcutSettingsComponent { | `onRecord` | Required | Called with the recorded `hotkey` and `context` when a recording commits | | `onCancel` | None | Called on `Escape`, `Tab`, `Shift+Tab`, the window losing focus, or `cancelRecording()` | | `cancelOnBlur` | `true` | Cancels when the window loses focus. Set `false` to keep recording | +| `target` | `window` | The window, or its document, to record in, such as a Picture-in-Picture window | | `onClear` | None | Called when `Backspace` or `Delete` is pressed with no recorded steps | | `maxSteps` | `1` | `1` for chords, `Infinity` for sequences | | `commitKeys` | `'enter'` | With `maxSteps: Infinity`, whether `Enter` commits (`'enter'`) or records as a step (`'none'`) | diff --git a/docs/framework/ember/guides/custom-hotkey-recording.md b/docs/framework/ember/guides/custom-hotkey-recording.md index e921b13e2..104407ffc 100644 --- a/docs/framework/ember/guides/custom-hotkey-recording.md +++ b/docs/framework/ember/guides/custom-hotkey-recording.md @@ -95,6 +95,8 @@ Options can also be a getter, such as `useHotkeyRecorder(this, () => ({ maxSteps The recorder also cancels and calls `onCancel` when the window loses focus, such as when the user switches apps or tabs, opens browser devtools, or clicks into an iframe. Set `cancelOnBlur: false` to keep recording. While debugging with devtools open, Chrome's **Rendering > Emulate a focused page** setting keeps the page focused. +To record in another window, such as a Picture-in-Picture window that holds the recorder's button, pass that window or its document as `target`. The recorder reads `target` when recording starts, listens only in that window, and cancels when that window loses focus or closes. A closed window doesn't start recording. + A click elsewhere on the page doesn't cancel, because the recorder doesn't know which element is your recorder. To cancel on a click outside it, listen for `pointerdown` while recording, for example in a modifier. Don't rely on the button's `blur` event: Safari and Firefox on macOS don't focus a button when it is clicked. ```gts @@ -304,6 +306,7 @@ export default class ShortcutSettings extends Component { | `onRecord` | Required | Called with the recorded hotkey when a recording commits, and with the same context as `validate` | | `onCancel` | None | Called when the user presses Escape, Tab, or Shift+Tab, when the window loses focus, or when you call `cancelRecording()` | | `cancelOnBlur` | `true` | Cancels the recording when the window loses focus. Set `false` to keep recording. | +| `target` | `window` | The window, or its document, to record in, such as a Picture-in-Picture window. | | `onClear` | None | Called when the user presses Backspace or Delete with nothing recorded | | `maxSteps` | `1` | `1` records a chord. `Infinity` records a sequence. | | `commitKeys` | `'enter'` | With `maxSteps: Infinity`, whether plain Enter commits (`'enter'`) or records as a step (`'none'`) | diff --git a/docs/framework/lit/guides/custom-hotkey-recording.md b/docs/framework/lit/guides/custom-hotkey-recording.md index 97563306e..8f8be3b76 100644 --- a/docs/framework/lit/guides/custom-hotkey-recording.md +++ b/docs/framework/lit/guides/custom-hotkey-recording.md @@ -106,6 +106,8 @@ Options can also be a getter, such as `new HotkeyRecorderController(this, () => The recorder also cancels and calls `onCancel` when the window loses focus, such as when the user switches apps or tabs, opens browser devtools, or clicks into an iframe. Set `cancelOnBlur: false` to keep recording. While debugging with devtools open, Chrome's **Rendering > Emulate a focused page** setting keeps the page focused. +To record in another window, such as a Picture-in-Picture window that holds the recorder's button, pass that window or its document as `target`. The recorder reads `target` when recording starts, listens only in that window, and cancels when that window loses focus or closes. A closed window doesn't start recording. + A click elsewhere on the page doesn't cancel, because the recorder doesn't know which element is your recorder. To cancel on a click outside it, listen for `pointerdown` while recording. Check `event.composedPath()`, because the document sees a click inside a shadow root as a click on its host. Don't rely on the button's `blur` event: Safari and Firefox on macOS don't focus a button when it is clicked. ```ts @@ -301,6 +303,7 @@ class ShortcutSettings extends LitElement { | `onRecord` | Required | Called with the recorded hotkey when a recording commits, and with the same context as `validate` | | `onCancel` | None | Called when the user presses Escape, Tab, or Shift+Tab, when the window loses focus, or when you call `cancelRecording()` | | `cancelOnBlur` | `true` | Cancels the recording when the window loses focus. Set `false` to keep recording. | +| `target` | `window` | The window, or its document, to record in, such as a Picture-in-Picture window. | | `onClear` | None | Called when the user presses Backspace or Delete with nothing recorded | | `maxSteps` | `1` | `1` records a chord. `Infinity` records a sequence. | | `commitKeys` | `'enter'` | With `maxSteps: Infinity`, whether plain Enter commits (`'enter'`) or records as a step (`'none'`) | diff --git a/docs/framework/octane/guides/custom-hotkey-recording.md b/docs/framework/octane/guides/custom-hotkey-recording.md index 6be54ea35..34e34a52d 100644 --- a/docs/framework/octane/guides/custom-hotkey-recording.md +++ b/docs/framework/octane/guides/custom-hotkey-recording.md @@ -85,6 +85,8 @@ If the user commits after a single chord, `useHotkeyRecorder` simplifies it to a The recorder also cancels and calls `onCancel` when the window loses focus, such as when the user switches apps or tabs, opens browser devtools, or clicks into an iframe. Set `cancelOnBlur: false` to keep recording. While debugging with devtools open, Chrome's **Rendering > Emulate a focused page** setting keeps the page focused. +To record in another window, such as a Picture-in-Picture window that holds the recorder's button, pass that window or its document as `target`. The recorder reads `target` when recording starts, listens only in that window, and cancels when that window loses focus or closes. A closed window doesn't start recording. + A click elsewhere on the page doesn't cancel, because the recorder doesn't know which element is your recorder. To cancel on a click outside it, listen for `pointerdown` while recording. Don't rely on the button's `blur` event: Safari and Firefox on macOS don't focus a button when it is clicked. ```tsx @@ -265,6 +267,7 @@ function ShortcutSettings() @{ | `onRecord` | Required | Called with the recorded `hotkey` and `context` when committed | | `onCancel` | None | Called on `Escape`, `Tab`, `Shift+Tab`, the window losing focus, or `cancelRecording()` | | `cancelOnBlur` | `true` | Cancels when the window loses focus. Set `false` to keep recording | +| `target` | `window` | The window, or its document, to record in, such as a Picture-in-Picture window | | `onClear` | None | Called when `Backspace` or `Delete` is pressed with no recorded steps | | `maxSteps` | `1` | `1` for chords, `Infinity` for sequences | | `commitKeys` | `'enter'` | With `maxSteps: Infinity`, whether `Enter` commits (`'enter'`) or records (`'none'`) | diff --git a/docs/framework/preact/guides/custom-hotkey-recording.md b/docs/framework/preact/guides/custom-hotkey-recording.md index d753a2f50..c0540c496 100644 --- a/docs/framework/preact/guides/custom-hotkey-recording.md +++ b/docs/framework/preact/guides/custom-hotkey-recording.md @@ -88,6 +88,8 @@ If the user commits after a single chord, `useHotkeyRecorder` simplifies it to a The recorder also cancels and calls `onCancel` when the window loses focus, such as when the user switches apps or tabs, opens browser devtools, or clicks into an iframe. Set `cancelOnBlur: false` to keep recording. While debugging with devtools open, Chrome's **Rendering > Emulate a focused page** setting keeps the page focused. +To record in another window, such as a Picture-in-Picture window that holds the recorder's button, pass that window or its document as `target`. The recorder reads `target` when recording starts, listens only in that window, and cancels when that window loses focus or closes. A closed window doesn't start recording. + A click elsewhere on the page doesn't cancel, because the recorder doesn't know which element is your recorder. To cancel on a click outside it, listen for `pointerdown` while recording. Don't rely on the button's `blur` event: Safari and Firefox on macOS don't focus a button when it is clicked. ```tsx @@ -273,6 +275,7 @@ function ShortcutSettings() { | `onRecord` | Required | Called with the recorded `hotkey` and `context` when committed | | `onCancel` | None | Called on `Escape`, `Tab`, `Shift+Tab`, the window losing focus, or `cancelRecording()` | | `cancelOnBlur` | `true` | Cancels when the window loses focus. Set `false` to keep recording | +| `target` | `window` | The window, or its document, to record in, such as a Picture-in-Picture window | | `onClear` | None | Called when `Backspace` or `Delete` is pressed with no recorded steps | | `maxSteps` | `1` | `1` for chords, `Infinity` for sequences | | `commitKeys` | `'enter'` | With `maxSteps: Infinity`, whether `Enter` commits (`'enter'`) or records (`'none'`) | diff --git a/docs/framework/react/guides/custom-hotkey-recording.md b/docs/framework/react/guides/custom-hotkey-recording.md index 06cf7d88b..883b3cde2 100644 --- a/docs/framework/react/guides/custom-hotkey-recording.md +++ b/docs/framework/react/guides/custom-hotkey-recording.md @@ -88,6 +88,8 @@ If the user commits after a single chord, `useHotkeyRecorder` simplifies it to a The recorder also cancels and calls `onCancel` when the window loses focus, such as when the user switches apps or tabs, opens browser devtools, or clicks into an iframe. Set `cancelOnBlur: false` to keep recording. While debugging with devtools open, Chrome's **Rendering > Emulate a focused page** setting keeps the page focused. +To record in another window, such as a Picture-in-Picture window that holds the recorder's button, pass that window or its document as `target`. The recorder reads `target` when recording starts, listens only in that window, and cancels when that window loses focus or closes. A closed window doesn't start recording. + A click elsewhere on the page doesn't cancel, because the recorder doesn't know which element is your recorder. To cancel on a click outside it, listen for `pointerdown` while recording. Don't rely on the button's `blur` event: Safari and Firefox on macOS don't focus a button when it is clicked. ```tsx @@ -273,6 +275,7 @@ function ShortcutSettings() { | `onRecord` | Required | Called with the recorded `hotkey` and `context` when committed | | `onCancel` | None | Called on `Escape`, `Tab`, `Shift+Tab`, the window losing focus, or `cancelRecording()` | | `cancelOnBlur` | `true` | Cancels when the window loses focus. Set `false` to keep recording | +| `target` | `window` | The window, or its document, to record in, such as a Picture-in-Picture window | | `onClear` | None | Called when `Backspace` or `Delete` is pressed with no recorded steps | | `maxSteps` | `1` | `1` for chords, `Infinity` for sequences | | `commitKeys` | `'enter'` | With `maxSteps: Infinity`, whether `Enter` commits (`'enter'`) or records (`'none'`) | diff --git a/docs/framework/solid/guides/custom-hotkey-recording.md b/docs/framework/solid/guides/custom-hotkey-recording.md index e45e5bcc0..837efa279 100644 --- a/docs/framework/solid/guides/custom-hotkey-recording.md +++ b/docs/framework/solid/guides/custom-hotkey-recording.md @@ -94,6 +94,8 @@ Options can also be an accessor, such as `createHotkeyRecorder(() => ({ maxSteps The recorder also cancels and calls `onCancel` when the window loses focus, such as when the user switches apps or tabs, opens browser devtools, or clicks into an iframe. Set `cancelOnBlur: false` to keep recording. While debugging with devtools open, Chrome's **Rendering > Emulate a focused page** setting keeps the page focused. +To record in another window, such as a Picture-in-Picture window that holds the recorder's button, pass that window or its document as `target`. The recorder reads `target` when recording starts, listens only in that window, and cancels when that window loses focus or closes. A closed window doesn't start recording. + A click elsewhere on the page doesn't cancel, because the recorder doesn't know which element is your recorder. To cancel on a click outside it, listen for `pointerdown` while recording. Don't rely on the button's `blur` event: Safari and Firefox on macOS don't focus a button when it is clicked. ```tsx @@ -278,6 +280,7 @@ function ShortcutSettings() { | `onRecord` | Required | Called with the recorded `hotkey` and `context` when committed | | `onCancel` | None | Called on `Escape`, `Tab`, `Shift+Tab`, the window losing focus, or `cancelRecording()` | | `cancelOnBlur` | `true` | Cancels when the window loses focus. Set `false` to keep recording | +| `target` | `window` | The window, or its document, to record in, such as a Picture-in-Picture window | | `onClear` | None | Called when `Backspace` or `Delete` is pressed with no recorded steps | | `maxSteps` | `1` | `1` for chords, `Infinity` for sequences | | `commitKeys` | `'enter'` | With `maxSteps: Infinity`, whether `Enter` commits (`'enter'`) or records (`'none'`) | diff --git a/docs/framework/svelte/guides/custom-hotkey-recording.md b/docs/framework/svelte/guides/custom-hotkey-recording.md index 7d00392d9..63c7c021c 100644 --- a/docs/framework/svelte/guides/custom-hotkey-recording.md +++ b/docs/framework/svelte/guides/custom-hotkey-recording.md @@ -91,6 +91,8 @@ Options can also be a getter, such as `createHotkeyRecorder(() => ({ maxSteps: I The recorder also cancels and calls `onCancel` when the window loses focus, such as when the user switches apps or tabs, opens browser devtools, or clicks into an iframe. Set `cancelOnBlur: false` to keep recording. While debugging with devtools open, Chrome's **Rendering > Emulate a focused page** setting keeps the page focused. +To record in another window, such as a Picture-in-Picture window that holds the recorder's button, pass that window or its document as `target`. The recorder reads `target` when recording starts, listens only in that window, and cancels when that window loses focus or closes. A closed window doesn't start recording. + A click elsewhere on the page doesn't cancel, because the recorder doesn't know which element is your recorder. To cancel on a click outside it, listen for `pointerdown` while recording. Don't rely on the button's `blur` event: Safari and Firefox on macOS don't focus a button when it is clicked. ```svelte @@ -269,6 +271,7 @@ For a few hotkeys in one component, `$state` is enough: | `onRecord` | Required | Called with the recorded `hotkey` and `context` when a recording commits | | `onCancel` | None | Called on `Escape`, `Tab`, `Shift+Tab`, the window losing focus, or `cancelRecording()` | | `cancelOnBlur` | `true` | Cancels when the window loses focus. Set `false` to keep recording | +| `target` | `window` | The window, or its document, to record in, such as a Picture-in-Picture window | | `onClear` | None | Called when `Backspace` or `Delete` is pressed with no recorded steps | | `maxSteps` | `1` | `1` for chords, `Infinity` for sequences | | `commitKeys` | `'enter'` | With `maxSteps: Infinity`, whether `Enter` commits (`'enter'`) or records as a step (`'none'`) | diff --git a/docs/framework/vue/guides/custom-hotkey-recording.md b/docs/framework/vue/guides/custom-hotkey-recording.md index 1d8edad44..b130448d4 100644 --- a/docs/framework/vue/guides/custom-hotkey-recording.md +++ b/docs/framework/vue/guides/custom-hotkey-recording.md @@ -98,6 +98,8 @@ Options can also be a ref or getter, such as `useHotkeyRecorder(() => ({ maxStep The recorder also cancels and calls `onCancel` when the window loses focus, such as when the user switches apps or tabs, opens browser devtools, or clicks into an iframe. Set `cancelOnBlur: false` to keep recording. While debugging with devtools open, Chrome's **Rendering > Emulate a focused page** setting keeps the page focused. +To record in another window, such as a Picture-in-Picture window that holds the recorder's button, pass that window or its document as `target`. The recorder reads `target` when recording starts, listens only in that window, and cancels when that window loses focus or closes. A closed window doesn't start recording. + A click elsewhere on the page doesn't cancel, because the recorder doesn't know which element is your recorder. To cancel on a click outside it, listen for `pointerdown` while recording. Don't rely on the button's `blur` event: Safari and Firefox on macOS don't focus a button when it is clicked. ```ts @@ -282,6 +284,7 @@ function edit(action: Action) { | `onRecord` | Required | Called with the recorded `hotkey` and `context` when a recording commits | | `onCancel` | None | Called on `Escape`, `Tab`, `Shift+Tab`, the window losing focus, or `cancelRecording()` | | `cancelOnBlur` | `true` | Cancels when the window loses focus. Set `false` to keep recording | +| `target` | `window` | The window, or its document, to record in, such as a Picture-in-Picture window | | `onClear` | None | Called when `Backspace` or `Delete` is pressed with no recorded steps | | `maxSteps` | `1` | `1` for chords, `Infinity` for sequences | | `commitKeys` | `'enter'` | With `maxSteps: Infinity`, whether `Enter` commits (`'enter'`) or records as a step (`'none'`) | diff --git a/docs/reference/classes/HotkeyManager.md b/docs/reference/classes/HotkeyManager.md index 0a9635f97..e20e9f77b 100644 --- a/docs/reference/classes/HotkeyManager.md +++ b/docs/reference/classes/HotkeyManager.md @@ -5,7 +5,7 @@ title: HotkeyManager -Defined in: [hotkey-manager.ts:602](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L602) +Defined in: [hotkey-manager.ts:627](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L627) ## Properties @@ -15,7 +15,7 @@ Defined in: [hotkey-manager.ts:602](https://github.com/TanStack/hotkeys/blob/mai readonly appHotkeys: Store; ``` -Defined in: [hotkey-manager.ts:629](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L629) +Defined in: [hotkey-manager.ts:654](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L654) The app hotkeys store published by a framework provider, so tools such as devtools can list declared hotkeys that are not registered. @@ -28,7 +28,7 @@ devtools can list declared hotkeys that are not registered. readonly registrations: Store>; ``` -Defined in: [hotkey-manager.ts:622](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L622) +Defined in: [hotkey-manager.ts:647](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L647) The TanStack Store containing all hotkey registrations, chords and sequences. Use this to subscribe to registration changes or access current registrations. @@ -57,7 +57,7 @@ for (const [id, reg] of manager.registrations.state) { readonly scopes: Store; ``` -Defined in: [hotkey-manager.ts:632](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L632) +Defined in: [hotkey-manager.ts:657](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L657) Active scopes. Subscribe to show which hotkeys are suspended. @@ -69,7 +69,7 @@ Active scopes. Subscribe to show which hotkeys are suspended. activateScope(scope, options?): () => void; ``` -Defined in: [hotkey-manager.ts:741](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L741) +Defined in: [hotkey-manager.ts:774](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L774) Activates a scope until the returned function is called. Activations are counted, so a scope stays active until every activation is released. @@ -113,7 +113,7 @@ manager.activateScope('dialog', { exclusive: { allow: ['global'] } }) destroy(): void; ``` -Defined in: [hotkey-manager.ts:2061](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2061) +Defined in: [hotkey-manager.ts:2137](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2137) Destroys the manager and removes all listeners. @@ -129,7 +129,7 @@ Destroys the manager and removes all listeners. getRegistrationCount(): number; ``` -Defined in: [hotkey-manager.ts:1993](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L1993) +Defined in: [hotkey-manager.ts:2069](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2069) Gets the number of registered hotkeys, chords and sequences. @@ -145,7 +145,7 @@ Gets the number of registered hotkeys, chords and sequences. hasActiveRegistration(hotkey): boolean; ``` -Defined in: [hotkey-manager.ts:2031](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2031) +Defined in: [hotkey-manager.ts:2107](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2107) Checks whether a hotkey can fire now: at least one registration is enabled, in an active scope, and listening where key presses go. A @@ -179,7 +179,7 @@ True if a registration that can fire exists isRegistered(hotkey, target?): boolean; ``` -Defined in: [hotkey-manager.ts:2004](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2004) +Defined in: [hotkey-manager.ts:2080](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2080) Checks if a specific hotkey is registered. @@ -211,7 +211,7 @@ True if a matching registration exists isScopeActive(scope?): boolean; ``` -Defined in: [hotkey-manager.ts:780](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L780) +Defined in: [hotkey-manager.ts:813](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L813) Whether hotkeys in a scope can fire: the scope is `'global'` or activated, and either no scope is exclusive or this scope is the @@ -239,7 +239,7 @@ register( ): HotkeyRegistrationHandle>; ``` -Defined in: [hotkey-manager.ts:998](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L998) +Defined in: [hotkey-manager.ts:1031](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L1031) Registers a hotkey handler and returns a handle for updating the registration. @@ -305,7 +305,7 @@ handle.unregister() resetSequenceProgress(): void; ``` -Defined in: [hotkey-manager.ts:1978](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L1978) +Defined in: [hotkey-manager.ts:2054](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2054) Resets the progress of every in-progress sequence. @@ -321,7 +321,7 @@ Resets the progress of every in-progress sequence. suspendCharacterKeys(): () => void; ``` -Defined in: [hotkey-manager.ts:807](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L807) +Defined in: [hotkey-manager.ts:840](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L840) Suspends document-level character key shortcuts until you call the returned function, so apps can let users turn off single-key shortcuts for @@ -357,7 +357,7 @@ resume() static getInstance(): HotkeyManager; ``` -Defined in: [hotkey-manager.ts:709](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L709) +Defined in: [hotkey-manager.ts:742](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L742) Gets the singleton instance of HotkeyManager. @@ -373,7 +373,7 @@ Gets the singleton instance of HotkeyManager. static resetInstance(): void; ``` -Defined in: [hotkey-manager.ts:716](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L716) +Defined in: [hotkey-manager.ts:749](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L749) Resets the singleton instance. Useful for testing. diff --git a/docs/reference/classes/HotkeyRecorder.md b/docs/reference/classes/HotkeyRecorder.md index 9b9958283..d0c62ea68 100644 --- a/docs/reference/classes/HotkeyRecorder.md +++ b/docs/reference/classes/HotkeyRecorder.md @@ -5,7 +5,7 @@ title: HotkeyRecorder -Defined in: [hotkey-recorder.ts:283](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L283) +Defined in: [hotkey-recorder.ts:291](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L291) Framework-agnostic class for recording keyboard shortcuts. @@ -51,7 +51,7 @@ recorder.destroy() new HotkeyRecorder(options): HotkeyRecorder; ``` -Defined in: [hotkey-recorder.ts:310](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L310) +Defined in: [hotkey-recorder.ts:323](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L323) #### Parameters @@ -69,7 +69,7 @@ Defined in: [hotkey-recorder.ts:310](https://github.com/TanStack/hotkeys/blob/ma new HotkeyRecorder(options): HotkeyRecorder; ``` -Defined in: [hotkey-recorder.ts:311](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L311) +Defined in: [hotkey-recorder.ts:324](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L324) #### Parameters @@ -89,7 +89,7 @@ Defined in: [hotkey-recorder.ts:311](https://github.com/TanStack/hotkeys/blob/ma readonly store: Store; ``` -Defined in: [hotkey-recorder.ts:284](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L284) +Defined in: [hotkey-recorder.ts:292](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L292) ## Methods @@ -99,7 +99,7 @@ Defined in: [hotkey-recorder.ts:284](https://github.com/TanStack/hotkeys/blob/ma cancel(): void; ``` -Defined in: [hotkey-recorder.ts:585](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L585) +Defined in: [hotkey-recorder.ts:610](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L610) Cancel recording without saving. @@ -118,7 +118,7 @@ the onCancel callback if provided. commit(): void; ``` -Defined in: [hotkey-recorder.ts:488](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L488) +Defined in: [hotkey-recorder.ts:511](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L511) Commits the recorded steps after validation and conflict checks. Called automatically at `maxSteps`, on Enter, or after `idleTimeoutMs`. @@ -136,7 +136,7 @@ A rejected commit leaves recording active with its steps intact. destroy(): void; ``` -Defined in: [hotkey-recorder.ts:598](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L598) +Defined in: [hotkey-recorder.ts:623](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L623) Clean up event listeners and reset state. @@ -155,7 +155,7 @@ all event listeners are properly removed. setOptions(options): void; ``` -Defined in: [hotkey-recorder.ts:321](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L321) +Defined in: [hotkey-recorder.ts:334](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L334) Updates the recorder options, including callbacks. This allows framework adapters to sync callback changes without recreating the recorder. @@ -178,7 +178,7 @@ This allows framework adapters to sync callback changes without recreating the r start(): void; ``` -Defined in: [hotkey-recorder.ts:353](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L353) +Defined in: [hotkey-recorder.ts:366](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L366) Start recording a new hotkey. @@ -197,7 +197,7 @@ and records chords according to `maxSteps`. stop(): void; ``` -Defined in: [hotkey-recorder.ts:575](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L575) +Defined in: [hotkey-recorder.ts:600](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L600) Stop recording (same as cancel, but doesn't call onCancel). diff --git a/docs/reference/functions/getHotkeyManager.md b/docs/reference/functions/getHotkeyManager.md index 13b1ed773..19c10a799 100644 --- a/docs/reference/functions/getHotkeyManager.md +++ b/docs/reference/functions/getHotkeyManager.md @@ -9,7 +9,7 @@ title: getHotkeyManager function getHotkeyManager(): HotkeyManager; ``` -Defined in: [hotkey-manager.ts:2076](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2076) +Defined in: [hotkey-manager.ts:2158](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2158) Gets the singleton HotkeyManager instance. Convenience function for accessing the manager. diff --git a/docs/reference/functions/toHotkeyRegistrationView.md b/docs/reference/functions/toHotkeyRegistrationView.md index f9ff3058f..2468d2d3c 100644 --- a/docs/reference/functions/toHotkeyRegistrationView.md +++ b/docs/reference/functions/toHotkeyRegistrationView.md @@ -9,7 +9,7 @@ title: toHotkeyRegistrationView function toHotkeyRegistrationView(reg): HotkeyRegistrationView; ``` -Defined in: [hotkey-manager.ts:319](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L319) +Defined in: [hotkey-manager.ts:321](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L321) Creates a public view from an internal registration, stripping the callback. diff --git a/docs/reference/interfaces/ActivateHotkeyScopeOptions.md b/docs/reference/interfaces/ActivateHotkeyScopeOptions.md index 09795c6fb..b3f4ac615 100644 --- a/docs/reference/interfaces/ActivateHotkeyScopeOptions.md +++ b/docs/reference/interfaces/ActivateHotkeyScopeOptions.md @@ -5,7 +5,7 @@ title: ActivateHotkeyScopeOptions -Defined in: [hotkey-manager.ts:549](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L549) +Defined in: [hotkey-manager.ts:574](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L574) Options for `HotkeyManager.activateScope`. @@ -21,7 +21,7 @@ optional exclusive?: }; ``` -Defined in: [hotkey-manager.ts:556](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L556) +Defined in: [hotkey-manager.ts:581](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L581) Suspend every other scope, including `'global'`, until this activation is released. Scopes nested in this one stay active. Pass `{ allow }` to keep @@ -36,7 +36,7 @@ still has to be activated, except `'global'`. optional parent?: string; ``` -Defined in: [hotkey-manager.ts:562](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L562) +Defined in: [hotkey-manager.ts:587](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L587) The scope this one is nested in. A nested scope takes precedence over its ancestors even when it was activated first, as nested providers are when diff --git a/docs/reference/interfaces/HotkeyChordOptions.md b/docs/reference/interfaces/HotkeyChordOptions.md index ecca35eaf..be7a4b989 100644 --- a/docs/reference/interfaces/HotkeyChordOptions.md +++ b/docs/reference/interfaces/HotkeyChordOptions.md @@ -5,7 +5,7 @@ title: HotkeyChordOptions -Defined in: [hotkey-manager.ts:164](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L164) +Defined in: [hotkey-manager.ts:166](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L166) Options for a single chord such as `'Mod+S'`. @@ -21,14 +21,15 @@ Options for a single chord such as `'Mod+S'`. optional afterDelegatedHandlers?: boolean; ``` -Defined in: [hotkey-manager.ts:160](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L160) +Defined in: [hotkey-manager.ts:162](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L162) Run after key handlers that a framework calls from one listener on its root or the document, such as React's `onKeyDown`, so handlers inside the target run first and can stop the hotkey. An element target then listens -on its document, or on its closed shadow root, instead of the element. A -stop by an earlier listener there skips the hotkey. Applies only to the -bubble phase. +on its document, or on its closed shadow root, instead of the element, +and follows the element when it moves to another document or shadow +root, such as a Picture-in-Picture window. A stop by an earlier listener +there skips the hotkey. Applies only to the bubble phase. Adapters for frameworks that delegate key events set this. #### Inherited from @@ -43,7 +44,7 @@ Adapters for frameworks that delegate key events set this. optional appHotkeyId?: string; ``` -Defined in: [hotkey-manager.ts:150](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L150) +Defined in: [hotkey-manager.ts:151](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L151) Id of the app hotkey this registration implements. Adapters set this when registering an app hotkey from `defineAppHotkeys`. @@ -59,7 +60,7 @@ Id of the app hotkey this registration implements. Adapters set this when regist optional capture?: boolean; ``` -Defined in: [hotkey-manager.ts:66](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L66) +Defined in: [hotkey-manager.ts:67](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L67) Listen during capture, before descendant listeners. Defaults to `false` (bubble). With `stopPropagation: true`, a match on an ancestor prevents the event from @@ -79,7 +80,7 @@ Changing this option preserves held-key reset state and sequence progress. optional conflictBehavior?: ConflictBehavior; ``` -Defined in: [hotkey-manager.ts:68](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L68) +Defined in: [hotkey-manager.ts:69](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L69) Behavior when this hotkey conflicts with an existing registration on the same target. Defaults to 'warn' @@ -95,7 +96,7 @@ Behavior when this hotkey conflicts with an existing registration on the same ta optional enabled?: boolean; ``` -Defined in: [hotkey-manager.ts:74](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L74) +Defined in: [hotkey-manager.ts:75](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L75) Soft-disable: when `false`, the callback does not run but the registration stays in `HotkeyManager` (and in devtools). Toggling this should update the @@ -113,7 +114,7 @@ existing handle via `setOptions` rather than unregistering. Defaults to `true`. optional eventType?: HotkeyEventType; ``` -Defined in: [hotkey-manager.ts:83](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L83) +Defined in: [hotkey-manager.ts:84](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L84) The event type to listen for. Defaults to 'keydown'. A 'keyup' chord fires when its key or one of its modifiers is released, whichever comes first, @@ -134,7 +135,7 @@ too. optional ignoreDefaultPrevented?: boolean; ``` -Defined in: [hotkey-manager.ts:89](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L89) +Defined in: [hotkey-manager.ts:90](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L90) Skip a key press that a listener outside TanStack Hotkeys already handled by calling `preventDefault()`, such as a component library's dialog that @@ -152,7 +153,7 @@ closes on Escape. Defaults to `false`. optional ignoreInputs?: boolean | "auto"; ``` -Defined in: [hotkey-manager.ts:105](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L105) +Defined in: [hotkey-manager.ts:106](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L106) Skip keys that a focused control inside the target uses itself: typing in text inputs, textarea, select, and contenteditable; Enter/Space on buttons @@ -180,7 +181,7 @@ and `Mod+C`. Set true on such a hotkey to leave the shortcut to the field. optional meta?: HotkeyMeta; ``` -Defined in: [hotkey-manager.ts:138](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L138) +Defined in: [hotkey-manager.ts:139](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L139) Optional metadata (name, description, custom fields via declaration merging). It can be written inline. A new `meta` with a changed string, @@ -200,7 +201,7 @@ old one but does not re-render them on its own. optional platform?: HotkeyPlatform; ``` -Defined in: [hotkey-manager.ts:107](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L107) +Defined in: [hotkey-manager.ts:108](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L108) The target platform for resolving 'Mod' @@ -216,7 +217,7 @@ The target platform for resolving 'Mod' optional preventDefault?: boolean | "always"; ``` -Defined in: [hotkey-manager.ts:117](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L117) +Defined in: [hotkey-manager.ts:118](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L118) Prevent the default browser action when the hotkey matches. For a sequence, every step that advances it does. Defaults to true. @@ -238,7 +239,7 @@ treat `'always'` as `true`. optional requireReset?: boolean; ``` -Defined in: [hotkey-manager.ts:166](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L166) +Defined in: [hotkey-manager.ts:168](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L168) If true, only trigger once until all keys are released. Default: false @@ -250,7 +251,7 @@ If true, only trigger once until all keys are released. Default: false optional scope?: string; ``` -Defined in: [hotkey-manager.ts:148](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L148) +Defined in: [hotkey-manager.ts:149](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L149) Scope this hotkey belongs to. Defaults to `'global'`, which is always active. Other scopes are active while activated with @@ -272,7 +273,7 @@ activated scope handles it. optional stopPropagation?: boolean; ``` -Defined in: [hotkey-manager.ts:122](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L122) +Defined in: [hotkey-manager.ts:123](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L123) Stop event propagation when the hotkey matches. For a sequence, only the last step does, so earlier steps reach other listeners. Defaults to true @@ -289,7 +290,7 @@ last step does, so earlier steps reach other listeners. Defaults to true optional target?: Target | null; ``` -Defined in: [hotkey-manager.ts:130](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L130) +Defined in: [hotkey-manager.ts:131](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L131) The DOM element to attach the event listener to. Defaults to document. In `register`, `null`, such as a `querySelector` that found nothing, diff --git a/docs/reference/interfaces/HotkeyChordRecorderOptions.md b/docs/reference/interfaces/HotkeyChordRecorderOptions.md index e0b58cde0..c2191846b 100644 --- a/docs/reference/interfaces/HotkeyChordRecorderOptions.md +++ b/docs/reference/interfaces/HotkeyChordRecorderOptions.md @@ -5,7 +5,7 @@ title: HotkeyChordRecorderOptions -Defined in: [hotkey-recorder.ts:186](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L186) +Defined in: [hotkey-recorder.ts:194](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L194) Options for recording a single chord. This is the default (`maxSteps: 1`). @@ -60,7 +60,7 @@ HotkeyRecorderBaseOptions.detectConflicts optional ignoreInputs?: boolean; ``` -Defined in: [hotkey-recorder.ts:175](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L175) +Defined in: [hotkey-recorder.ts:183](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L183) Whether to ignore keyboard events from input-like elements (text inputs, textarea, select, contenteditable) while recording. When true, typing in @@ -80,7 +80,7 @@ HotkeyRecorderBaseOptions.ignoreInputs optional maxSteps?: 1; ``` -Defined in: [hotkey-recorder.ts:188](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L188) +Defined in: [hotkey-recorder.ts:196](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L196) Maximum number of chords to record. Default: 1 @@ -115,7 +115,7 @@ HotkeyRecorderBaseOptions.onCancel optional onClear?: () => void; ``` -Defined in: [hotkey-recorder.ts:169](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L169) +Defined in: [hotkey-recorder.ts:177](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L177) Optional callback when the recording is cleared: Backspace/Delete with no modifiers and no recorded steps @@ -138,7 +138,7 @@ HotkeyRecorderBaseOptions.onClear onRecord: (hotkey, context) => void; ``` -Defined in: [hotkey-recorder.ts:198](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L198) +Defined in: [hotkey-recorder.ts:206](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L206) Callback when a chord is successfully recorded. `context` is the one `validate` received, with the key press that recorded the chord. @@ -229,7 +229,7 @@ HotkeyRecorderBaseOptions.recordBy optional recordTab?: boolean; ``` -Defined in: [hotkey-recorder.ts:182](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L182) +Defined in: [hotkey-recorder.ts:190](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L190) Whether to record Tab and Shift+Tab. By default they cancel recording and move focus, so keyboard users can leave the recorder. Tab with Control, @@ -244,13 +244,35 @@ HotkeyRecorderBaseOptions.recordTab *** +### target? + +```ts +optional target?: Window | Document | null; +``` + +Defined in: [hotkey-recorder.ts:172](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L172) + +The window to record key presses in, or its document, such as a +Picture-in-Picture window that holds the recorder's button. Recording +listens only there, and `cancelOnBlur` follows that window. Closing the +window cancels, and a closed window doesn't start recording. Read when +recording starts. Default: the page's `window` + +#### Inherited from + +```ts +HotkeyRecorderBaseOptions.target +``` + +*** + ### validate? ```ts optional validate?: (hotkey, context) => string | boolean; ``` -Defined in: [hotkey-recorder.ts:190](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L190) +Defined in: [hotkey-recorder.ts:198](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L198) Return true to accept, or false or a message to reject while staying in recording mode. The message is passed to `onReject`. diff --git a/docs/reference/interfaces/HotkeyChordRegistration.md b/docs/reference/interfaces/HotkeyChordRegistration.md index a68cc93cb..c9b213a9b 100644 --- a/docs/reference/interfaces/HotkeyChordRegistration.md +++ b/docs/reference/interfaces/HotkeyChordRegistration.md @@ -5,7 +5,7 @@ title: HotkeyChordRegistration -Defined in: [hotkey-manager.ts:209](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L209) +Defined in: [hotkey-manager.ts:211](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L211) A registered chord in the HotkeyManager. @@ -21,7 +21,7 @@ A registered chord in the HotkeyManager. optional activeMatch?: KeyIdentity; ``` -Defined in: [hotkey-manager.ts:214](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L214) +Defined in: [hotkey-manager.ts:216](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L216) The concrete key/code that activated a requireReset registration. @@ -33,7 +33,7 @@ The concrete key/code that activated a requireReset registration. callback: HotkeyCallback; ``` -Defined in: [hotkey-manager.ts:197](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L197) +Defined in: [hotkey-manager.ts:199](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L199) The callback to invoke @@ -51,7 +51,7 @@ RegistrationBase.callback hasFired: boolean; ``` -Defined in: [hotkey-manager.ts:205](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L205) +Defined in: [hotkey-manager.ts:207](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L207) Whether this registration has fired (and, for requireReset chords, needs a reset) @@ -69,7 +69,7 @@ RegistrationBase.hasFired hotkey: HotkeyChord; ``` -Defined in: [hotkey-manager.ts:211](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L211) +Defined in: [hotkey-manager.ts:213](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L213) *** @@ -79,7 +79,7 @@ Defined in: [hotkey-manager.ts:211](https://github.com/TanStack/hotkeys/blob/mai id: string; ``` -Defined in: [hotkey-manager.ts:195](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L195) +Defined in: [hotkey-manager.ts:197](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L197) Unique identifier for this registration @@ -97,7 +97,7 @@ RegistrationBase.id kind: "chord"; ``` -Defined in: [hotkey-manager.ts:210](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L210) +Defined in: [hotkey-manager.ts:212](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L212) *** @@ -107,7 +107,7 @@ Defined in: [hotkey-manager.ts:210](https://github.com/TanStack/hotkeys/blob/mai options: HotkeyChordOptions; ``` -Defined in: [hotkey-manager.ts:199](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L199) +Defined in: [hotkey-manager.ts:201](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L201) Resolved options for this registration @@ -125,7 +125,7 @@ RegistrationBase.options parsedChord: ParsedHotkeyChord; ``` -Defined in: [hotkey-manager.ts:212](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L212) +Defined in: [hotkey-manager.ts:214](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L214) *** @@ -135,7 +135,7 @@ Defined in: [hotkey-manager.ts:212](https://github.com/TanStack/hotkeys/blob/mai target: Target; ``` -Defined in: [hotkey-manager.ts:201](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L201) +Defined in: [hotkey-manager.ts:203](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L203) The resolved target element for this registration @@ -153,7 +153,7 @@ RegistrationBase.target triggerCount: number; ``` -Defined in: [hotkey-manager.ts:203](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L203) +Defined in: [hotkey-manager.ts:205](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L205) How many times this registration's callback has been triggered diff --git a/docs/reference/interfaces/HotkeyChordRegistrationView.md b/docs/reference/interfaces/HotkeyChordRegistrationView.md index ad1fdca2f..551e07176 100644 --- a/docs/reference/interfaces/HotkeyChordRegistrationView.md +++ b/docs/reference/interfaces/HotkeyChordRegistrationView.md @@ -5,7 +5,7 @@ title: HotkeyChordRegistrationView -Defined in: [hotkey-manager.ts:253](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L253) +Defined in: [hotkey-manager.ts:255](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L255) Public view of a chord registration, without its callback. @@ -21,7 +21,7 @@ Public view of a chord registration, without its callback. hasFired: boolean; ``` -Defined in: [hotkey-manager.ts:249](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L249) +Defined in: [hotkey-manager.ts:251](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L251) #### Inherited from @@ -37,7 +37,7 @@ RegistrationViewBase.hasFired hotkey: HotkeyChord; ``` -Defined in: [hotkey-manager.ts:255](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L255) +Defined in: [hotkey-manager.ts:257](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L257) *** @@ -47,7 +47,7 @@ Defined in: [hotkey-manager.ts:255](https://github.com/TanStack/hotkeys/blob/mai id: string; ``` -Defined in: [hotkey-manager.ts:244](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L244) +Defined in: [hotkey-manager.ts:246](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L246) #### Inherited from @@ -63,7 +63,7 @@ RegistrationViewBase.id kind: "chord"; ``` -Defined in: [hotkey-manager.ts:254](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L254) +Defined in: [hotkey-manager.ts:256](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L256) *** @@ -73,7 +73,7 @@ Defined in: [hotkey-manager.ts:254](https://github.com/TanStack/hotkeys/blob/mai options: HotkeyChordOptions; ``` -Defined in: [hotkey-manager.ts:257](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L257) +Defined in: [hotkey-manager.ts:259](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L259) *** @@ -83,7 +83,7 @@ Defined in: [hotkey-manager.ts:257](https://github.com/TanStack/hotkeys/blob/mai parsedChord: ParsedHotkeyChord; ``` -Defined in: [hotkey-manager.ts:256](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L256) +Defined in: [hotkey-manager.ts:258](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L258) *** @@ -93,7 +93,7 @@ Defined in: [hotkey-manager.ts:256](https://github.com/TanStack/hotkeys/blob/mai status: HotkeyRegistrationStatus; ``` -Defined in: [hotkey-manager.ts:246](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L246) +Defined in: [hotkey-manager.ts:248](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L248) Whether the registration is enabled and in an active scope. @@ -111,7 +111,7 @@ RegistrationViewBase.status target: Target; ``` -Defined in: [hotkey-manager.ts:247](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L247) +Defined in: [hotkey-manager.ts:249](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L249) #### Inherited from @@ -127,7 +127,7 @@ RegistrationViewBase.target triggerCount: number; ``` -Defined in: [hotkey-manager.ts:248](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L248) +Defined in: [hotkey-manager.ts:250](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L250) #### Inherited from diff --git a/docs/reference/interfaces/HotkeyOptions.md b/docs/reference/interfaces/HotkeyOptions.md index d7e19fe9a..f196dd1fe 100644 --- a/docs/reference/interfaces/HotkeyOptions.md +++ b/docs/reference/interfaces/HotkeyOptions.md @@ -5,7 +5,7 @@ title: HotkeyOptions -Defined in: [hotkey-manager.ts:58](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L58) +Defined in: [hotkey-manager.ts:59](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L59) Options shared by chords and sequences. @@ -22,14 +22,15 @@ Options shared by chords and sequences. optional afterDelegatedHandlers?: boolean; ``` -Defined in: [hotkey-manager.ts:160](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L160) +Defined in: [hotkey-manager.ts:162](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L162) Run after key handlers that a framework calls from one listener on its root or the document, such as React's `onKeyDown`, so handlers inside the target run first and can stop the hotkey. An element target then listens -on its document, or on its closed shadow root, instead of the element. A -stop by an earlier listener there skips the hotkey. Applies only to the -bubble phase. +on its document, or on its closed shadow root, instead of the element, +and follows the element when it moves to another document or shadow +root, such as a Picture-in-Picture window. A stop by an earlier listener +there skips the hotkey. Applies only to the bubble phase. Adapters for frameworks that delegate key events set this. *** @@ -40,7 +41,7 @@ Adapters for frameworks that delegate key events set this. optional appHotkeyId?: string; ``` -Defined in: [hotkey-manager.ts:150](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L150) +Defined in: [hotkey-manager.ts:151](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L151) Id of the app hotkey this registration implements. Adapters set this when registering an app hotkey from `defineAppHotkeys`. @@ -52,7 +53,7 @@ Id of the app hotkey this registration implements. Adapters set this when regist optional capture?: boolean; ``` -Defined in: [hotkey-manager.ts:66](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L66) +Defined in: [hotkey-manager.ts:67](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L67) Listen during capture, before descendant listeners. Defaults to `false` (bubble). With `stopPropagation: true`, a match on an ancestor prevents the event from @@ -68,7 +69,7 @@ Changing this option preserves held-key reset state and sequence progress. optional conflictBehavior?: ConflictBehavior; ``` -Defined in: [hotkey-manager.ts:68](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L68) +Defined in: [hotkey-manager.ts:69](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L69) Behavior when this hotkey conflicts with an existing registration on the same target. Defaults to 'warn' @@ -80,7 +81,7 @@ Behavior when this hotkey conflicts with an existing registration on the same ta optional enabled?: boolean; ``` -Defined in: [hotkey-manager.ts:74](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L74) +Defined in: [hotkey-manager.ts:75](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L75) Soft-disable: when `false`, the callback does not run but the registration stays in `HotkeyManager` (and in devtools). Toggling this should update the @@ -94,7 +95,7 @@ existing handle via `setOptions` rather than unregistering. Defaults to `true`. optional eventType?: HotkeyEventType; ``` -Defined in: [hotkey-manager.ts:83](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L83) +Defined in: [hotkey-manager.ts:84](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L84) The event type to listen for. Defaults to 'keydown'. A 'keyup' chord fires when its key or one of its modifiers is released, whichever comes first, @@ -111,7 +112,7 @@ too. optional ignoreDefaultPrevented?: boolean; ``` -Defined in: [hotkey-manager.ts:89](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L89) +Defined in: [hotkey-manager.ts:90](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L90) Skip a key press that a listener outside TanStack Hotkeys already handled by calling `preventDefault()`, such as a component library's dialog that @@ -125,7 +126,7 @@ closes on Escape. Defaults to `false`. optional ignoreInputs?: boolean | "auto"; ``` -Defined in: [hotkey-manager.ts:105](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L105) +Defined in: [hotkey-manager.ts:106](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L106) Skip keys that a focused control inside the target uses itself: typing in text inputs, textarea, select, and contenteditable; Enter/Space on buttons @@ -149,7 +150,7 @@ and `Mod+C`. Set true on such a hotkey to leave the shortcut to the field. optional meta?: HotkeyMeta; ``` -Defined in: [hotkey-manager.ts:138](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L138) +Defined in: [hotkey-manager.ts:139](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L139) Optional metadata (name, description, custom fields via declaration merging). It can be written inline. A new `meta` with a changed string, @@ -165,7 +166,7 @@ old one but does not re-render them on its own. optional platform?: HotkeyPlatform; ``` -Defined in: [hotkey-manager.ts:107](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L107) +Defined in: [hotkey-manager.ts:108](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L108) The target platform for resolving 'Mod' @@ -177,7 +178,7 @@ The target platform for resolving 'Mod' optional preventDefault?: boolean | "always"; ``` -Defined in: [hotkey-manager.ts:117](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L117) +Defined in: [hotkey-manager.ts:118](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L118) Prevent the default browser action when the hotkey matches. For a sequence, every step that advances it does. Defaults to true. @@ -195,7 +196,7 @@ treat `'always'` as `true`. optional scope?: string; ``` -Defined in: [hotkey-manager.ts:148](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L148) +Defined in: [hotkey-manager.ts:149](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L149) Scope this hotkey belongs to. Defaults to `'global'`, which is always active. Other scopes are active while activated with @@ -213,7 +214,7 @@ activated scope handles it. optional stopPropagation?: boolean; ``` -Defined in: [hotkey-manager.ts:122](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L122) +Defined in: [hotkey-manager.ts:123](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L123) Stop event propagation when the hotkey matches. For a sequence, only the last step does, so earlier steps reach other listeners. Defaults to true @@ -226,7 +227,7 @@ last step does, so earlier steps reach other listeners. Defaults to true optional target?: Target | null; ``` -Defined in: [hotkey-manager.ts:130](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L130) +Defined in: [hotkey-manager.ts:131](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L131) The DOM element to attach the event listener to. Defaults to document. In `register`, `null`, such as a `querySelector` that found nothing, diff --git a/docs/reference/interfaces/HotkeyRegistrationHandle.md b/docs/reference/interfaces/HotkeyRegistrationHandle.md index 26c9cb087..b4df4f4d4 100644 --- a/docs/reference/interfaces/HotkeyRegistrationHandle.md +++ b/docs/reference/interfaces/HotkeyRegistrationHandle.md @@ -5,7 +5,7 @@ title: HotkeyRegistrationHandle -Defined in: [hotkey-manager.ts:369](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L369) +Defined in: [hotkey-manager.ts:371](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L371) A handle returned from HotkeyManager.register() that allows updating the callback and options without re-registering the hotkey. @@ -41,7 +41,7 @@ handle.unregister() callback: HotkeyCallback; ``` -Defined in: [hotkey-manager.ts:376](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L376) +Defined in: [hotkey-manager.ts:378](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L378) The callback function. Can be set directly to update without re-registering. This avoids stale closures when the callback references React state. @@ -54,7 +54,7 @@ This avoids stale closures when the callback references React state. readonly id: string; ``` -Defined in: [hotkey-manager.ts:378](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L378) +Defined in: [hotkey-manager.ts:380](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L380) Unique identifier for this registration @@ -66,7 +66,7 @@ Unique identifier for this registration readonly isActive: boolean; ``` -Defined in: [hotkey-manager.ts:380](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L380) +Defined in: [hotkey-manager.ts:382](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L382) Check if this registration is still active (not unregistered) @@ -78,7 +78,7 @@ Check if this registration is still active (not unregistered) setOptions: (options) => void; ``` -Defined in: [hotkey-manager.ts:388](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L388) +Defined in: [hotkey-manager.ts:390](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L390) Update options (merged with existing options). Useful for updating `enabled`, `preventDefault`, etc. without re-registering. @@ -104,7 +104,7 @@ cannot process it again in another phase. unregister: () => void; ``` -Defined in: [hotkey-manager.ts:390](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L390) +Defined in: [hotkey-manager.ts:392](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L392) Unregister this hotkey diff --git a/docs/reference/interfaces/HotkeyRegistrationsResult.md b/docs/reference/interfaces/HotkeyRegistrationsResult.md index 3a3c1bd5c..c1c8c62f6 100644 --- a/docs/reference/interfaces/HotkeyRegistrationsResult.md +++ b/docs/reference/interfaces/HotkeyRegistrationsResult.md @@ -5,7 +5,7 @@ title: HotkeyRegistrationsResult -Defined in: [hotkey-manager.ts:281](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L281) +Defined in: [hotkey-manager.ts:283](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L283) The registrations an adapter reports, chords and sequences. @@ -17,6 +17,6 @@ The registrations an adapter reports, chords and sequences. readonly hotkeys: HotkeyRegistrationView[]; ``` -Defined in: [hotkey-manager.ts:283](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L283) +Defined in: [hotkey-manager.ts:285](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L285) Every registration, chords and sequences. Narrow each view with `kind`. diff --git a/docs/reference/interfaces/HotkeyScopesState.md b/docs/reference/interfaces/HotkeyScopesState.md index 2ffd4162c..00c924278 100644 --- a/docs/reference/interfaces/HotkeyScopesState.md +++ b/docs/reference/interfaces/HotkeyScopesState.md @@ -5,7 +5,7 @@ title: HotkeyScopesState -Defined in: [hotkey-manager.ts:522](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L522) +Defined in: [hotkey-manager.ts:547](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L547) Active hotkey scopes, published on `HotkeyManager.scopes`. @@ -17,7 +17,7 @@ Active hotkey scopes, published on `HotkeyManager.scopes`. active: readonly string[]; ``` -Defined in: [hotkey-manager.ts:527](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L527) +Defined in: [hotkey-manager.ts:552](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L552) Activated scopes, lowest precedence first. `'global'` is always active and not listed. @@ -30,7 +30,7 @@ and not listed. allowed: readonly string[]; ``` -Defined in: [hotkey-manager.ts:534](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L534) +Defined in: [hotkey-manager.ts:559](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L559) Scopes the exclusive scope allows that are active, possibly including `'global'`. Empty when no scope is exclusive. @@ -43,7 +43,7 @@ Scopes the exclusive scope allows that are active, possibly including characterKeysSuspended: boolean; ``` -Defined in: [hotkey-manager.ts:545](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L545) +Defined in: [hotkey-manager.ts:570](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L570) Whether character key shortcuts, such as `K` or `Shift+/`, are suspended by `suspendCharacterKeys`. Hotkeys on an element other than the body or the @@ -57,7 +57,7 @@ root element are not suspended. exclusive: string | null; ``` -Defined in: [hotkey-manager.ts:529](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L529) +Defined in: [hotkey-manager.ts:554](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L554) The exclusive scope that owns the keyboard, or `null` when none is active. @@ -69,7 +69,7 @@ The exclusive scope that owns the keyboard, or `null` when none is active. suspended: readonly string[]; ``` -Defined in: [hotkey-manager.ts:539](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L539) +Defined in: [hotkey-manager.ts:564](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L564) Scopes that are active but cannot fire because another scope is exclusive, possibly including `'global'`. diff --git a/docs/reference/interfaces/HotkeySequenceOptions.md b/docs/reference/interfaces/HotkeySequenceOptions.md index 9213ba747..22b55d758 100644 --- a/docs/reference/interfaces/HotkeySequenceOptions.md +++ b/docs/reference/interfaces/HotkeySequenceOptions.md @@ -5,7 +5,7 @@ title: HotkeySequenceOptions -Defined in: [hotkey-manager.ts:170](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L170) +Defined in: [hotkey-manager.ts:172](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L172) Options for a sequence such as `['G', 'G']`. @@ -21,14 +21,15 @@ Options for a sequence such as `['G', 'G']`. optional afterDelegatedHandlers?: boolean; ``` -Defined in: [hotkey-manager.ts:160](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L160) +Defined in: [hotkey-manager.ts:162](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L162) Run after key handlers that a framework calls from one listener on its root or the document, such as React's `onKeyDown`, so handlers inside the target run first and can stop the hotkey. An element target then listens -on its document, or on its closed shadow root, instead of the element. A -stop by an earlier listener there skips the hotkey. Applies only to the -bubble phase. +on its document, or on its closed shadow root, instead of the element, +and follows the element when it moves to another document or shadow +root, such as a Picture-in-Picture window. A stop by an earlier listener +there skips the hotkey. Applies only to the bubble phase. Adapters for frameworks that delegate key events set this. #### Inherited from @@ -43,7 +44,7 @@ Adapters for frameworks that delegate key events set this. optional appHotkeyId?: string; ``` -Defined in: [hotkey-manager.ts:150](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L150) +Defined in: [hotkey-manager.ts:151](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L151) Id of the app hotkey this registration implements. Adapters set this when registering an app hotkey from `defineAppHotkeys`. @@ -59,7 +60,7 @@ Id of the app hotkey this registration implements. Adapters set this when regist optional capture?: boolean; ``` -Defined in: [hotkey-manager.ts:66](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L66) +Defined in: [hotkey-manager.ts:67](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L67) Listen during capture, before descendant listeners. Defaults to `false` (bubble). With `stopPropagation: true`, a match on an ancestor prevents the event from @@ -79,7 +80,7 @@ Changing this option preserves held-key reset state and sequence progress. optional conflictBehavior?: ConflictBehavior; ``` -Defined in: [hotkey-manager.ts:68](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L68) +Defined in: [hotkey-manager.ts:69](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L69) Behavior when this hotkey conflicts with an existing registration on the same target. Defaults to 'warn' @@ -95,7 +96,7 @@ Behavior when this hotkey conflicts with an existing registration on the same ta optional enabled?: boolean; ``` -Defined in: [hotkey-manager.ts:74](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L74) +Defined in: [hotkey-manager.ts:75](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L75) Soft-disable: when `false`, the callback does not run but the registration stays in `HotkeyManager` (and in devtools). Toggling this should update the @@ -113,7 +114,7 @@ existing handle via `setOptions` rather than unregistering. Defaults to `true`. optional eventType?: HotkeyEventType; ``` -Defined in: [hotkey-manager.ts:83](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L83) +Defined in: [hotkey-manager.ts:84](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L84) The event type to listen for. Defaults to 'keydown'. A 'keyup' chord fires when its key or one of its modifiers is released, whichever comes first, @@ -134,7 +135,7 @@ too. optional ignoreDefaultPrevented?: boolean; ``` -Defined in: [hotkey-manager.ts:89](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L89) +Defined in: [hotkey-manager.ts:90](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L90) Skip a key press that a listener outside TanStack Hotkeys already handled by calling `preventDefault()`, such as a component library's dialog that @@ -152,7 +153,7 @@ closes on Escape. Defaults to `false`. optional ignoreInputs?: boolean | "auto"; ``` -Defined in: [hotkey-manager.ts:105](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L105) +Defined in: [hotkey-manager.ts:106](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L106) Skip keys that a focused control inside the target uses itself: typing in text inputs, textarea, select, and contenteditable; Enter/Space on buttons @@ -180,7 +181,7 @@ and `Mod+C`. Set true on such a hotkey to leave the shortcut to the field. optional meta?: HotkeyMeta; ``` -Defined in: [hotkey-manager.ts:138](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L138) +Defined in: [hotkey-manager.ts:139](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L139) Optional metadata (name, description, custom fields via declaration merging). It can be written inline. A new `meta` with a changed string, @@ -200,7 +201,7 @@ old one but does not re-render them on its own. optional platform?: HotkeyPlatform; ``` -Defined in: [hotkey-manager.ts:107](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L107) +Defined in: [hotkey-manager.ts:108](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L108) The target platform for resolving 'Mod' @@ -216,7 +217,7 @@ The target platform for resolving 'Mod' optional preventDefault?: boolean | "always"; ``` -Defined in: [hotkey-manager.ts:117](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L117) +Defined in: [hotkey-manager.ts:118](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L118) Prevent the default browser action when the hotkey matches. For a sequence, every step that advances it does. Defaults to true. @@ -238,7 +239,7 @@ treat `'always'` as `true`. optional scope?: string; ``` -Defined in: [hotkey-manager.ts:148](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L148) +Defined in: [hotkey-manager.ts:149](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L149) Scope this hotkey belongs to. Defaults to `'global'`, which is always active. Other scopes are active while activated with @@ -260,7 +261,7 @@ activated scope handles it. optional stopPropagation?: boolean; ``` -Defined in: [hotkey-manager.ts:122](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L122) +Defined in: [hotkey-manager.ts:123](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L123) Stop event propagation when the hotkey matches. For a sequence, only the last step does, so earlier steps reach other listeners. Defaults to true @@ -277,7 +278,7 @@ last step does, so earlier steps reach other listeners. Defaults to true optional target?: Target | null; ``` -Defined in: [hotkey-manager.ts:130](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L130) +Defined in: [hotkey-manager.ts:131](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L131) The DOM element to attach the event listener to. Defaults to document. In `register`, `null`, such as a `querySelector` that found nothing, @@ -297,6 +298,6 @@ registration to another target. optional timeout?: number; ``` -Defined in: [hotkey-manager.ts:172](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L172) +Defined in: [hotkey-manager.ts:174](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L174) Maximum time between steps in milliseconds. Default: 1000 diff --git a/docs/reference/interfaces/HotkeySequenceRecorderOptions.md b/docs/reference/interfaces/HotkeySequenceRecorderOptions.md index 0cbcc7f36..e12c45c0b 100644 --- a/docs/reference/interfaces/HotkeySequenceRecorderOptions.md +++ b/docs/reference/interfaces/HotkeySequenceRecorderOptions.md @@ -5,7 +5,7 @@ title: HotkeySequenceRecorderOptions -Defined in: [hotkey-recorder.ts:208](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L208) +Defined in: [hotkey-recorder.ts:216](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L216) Options for recording up to `maxSteps` chords. A one-step recording commits as a chord string; two or more steps commit as a sequence. @@ -43,7 +43,7 @@ HotkeyRecorderBaseOptions.cancelOnBlur optional commitKeys?: HotkeyRecorderCommitKeys; ``` -Defined in: [hotkey-recorder.ts:222](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L222) +Defined in: [hotkey-recorder.ts:230](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L230) Whether plain Enter commits the recorded steps. Default: 'enter' @@ -73,7 +73,7 @@ HotkeyRecorderBaseOptions.detectConflicts optional idleTimeoutMs?: number; ``` -Defined in: [hotkey-recorder.ts:224](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L224) +Defined in: [hotkey-recorder.ts:232](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L232) Commit automatically after this many milliseconds without a new step. Disabled when unset or 0. @@ -85,7 +85,7 @@ Commit automatically after this many milliseconds without a new step. Disabled w optional ignoreInputs?: boolean; ``` -Defined in: [hotkey-recorder.ts:175](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L175) +Defined in: [hotkey-recorder.ts:183](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L183) Whether to ignore keyboard events from input-like elements (text inputs, textarea, select, contenteditable) while recording. When true, typing in @@ -105,7 +105,7 @@ HotkeyRecorderBaseOptions.ignoreInputs maxSteps: number; ``` -Defined in: [hotkey-recorder.ts:210](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L210) +Defined in: [hotkey-recorder.ts:218](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L218) Maximum number of chords to record. Reaching it commits automatically. Use `Infinity` for no limit. @@ -140,7 +140,7 @@ HotkeyRecorderBaseOptions.onCancel optional onClear?: () => void; ``` -Defined in: [hotkey-recorder.ts:169](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L169) +Defined in: [hotkey-recorder.ts:177](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L177) Optional callback when the recording is cleared: Backspace/Delete with no modifiers and no recorded steps @@ -163,7 +163,7 @@ HotkeyRecorderBaseOptions.onClear onRecord: (hotkey, context) => void; ``` -Defined in: [hotkey-recorder.ts:220](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L220) +Defined in: [hotkey-recorder.ts:228](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L228) Callback when a hotkey is successfully recorded. `context` is the one `validate` received, with the key press that recorded each step. @@ -254,7 +254,7 @@ HotkeyRecorderBaseOptions.recordBy optional recordTab?: boolean; ``` -Defined in: [hotkey-recorder.ts:182](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L182) +Defined in: [hotkey-recorder.ts:190](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L190) Whether to record Tab and Shift+Tab. By default they cancel recording and move focus, so keyboard users can leave the recorder. Tab with Control, @@ -269,13 +269,35 @@ HotkeyRecorderBaseOptions.recordTab *** +### target? + +```ts +optional target?: Window | Document | null; +``` + +Defined in: [hotkey-recorder.ts:172](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L172) + +The window to record key presses in, or its document, such as a +Picture-in-Picture window that holds the recorder's button. Recording +listens only there, and `cancelOnBlur` follows that window. Closing the +window cancels, and a closed window doesn't start recording. Read when +recording starts. Default: the page's `window` + +#### Inherited from + +```ts +HotkeyRecorderBaseOptions.target +``` + +*** + ### validate? ```ts optional validate?: (hotkey, context) => string | boolean; ``` -Defined in: [hotkey-recorder.ts:212](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L212) +Defined in: [hotkey-recorder.ts:220](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L220) Return true to accept, or false or a message to reject while staying in recording mode. The message is passed to `onReject`. diff --git a/docs/reference/interfaces/HotkeySequenceRegistration.md b/docs/reference/interfaces/HotkeySequenceRegistration.md index 46ad20e83..376ccd04c 100644 --- a/docs/reference/interfaces/HotkeySequenceRegistration.md +++ b/docs/reference/interfaces/HotkeySequenceRegistration.md @@ -5,7 +5,7 @@ title: HotkeySequenceRegistration -Defined in: [hotkey-manager.ts:218](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L218) +Defined in: [hotkey-manager.ts:220](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L220) A registered sequence in the HotkeyManager. @@ -21,7 +21,7 @@ A registered sequence in the HotkeyManager. callback: HotkeyCallback; ``` -Defined in: [hotkey-manager.ts:197](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L197) +Defined in: [hotkey-manager.ts:199](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L199) The callback to invoke @@ -39,7 +39,7 @@ RegistrationBase.callback currentIndex: number; ``` -Defined in: [hotkey-manager.ts:223](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L223) +Defined in: [hotkey-manager.ts:225](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L225) Steps matched in the current attempt @@ -51,7 +51,7 @@ Steps matched in the current attempt hasFired: boolean; ``` -Defined in: [hotkey-manager.ts:205](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L205) +Defined in: [hotkey-manager.ts:207](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L207) Whether this registration has fired (and, for requireReset chords, needs a reset) @@ -69,7 +69,7 @@ RegistrationBase.hasFired hotkey: HotkeySequence; ``` -Defined in: [hotkey-manager.ts:220](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L220) +Defined in: [hotkey-manager.ts:222](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L222) *** @@ -79,7 +79,7 @@ Defined in: [hotkey-manager.ts:220](https://github.com/TanStack/hotkeys/blob/mai id: string; ``` -Defined in: [hotkey-manager.ts:195](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L195) +Defined in: [hotkey-manager.ts:197](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L197) Unique identifier for this registration @@ -97,7 +97,7 @@ RegistrationBase.id kind: "sequence"; ``` -Defined in: [hotkey-manager.ts:219](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L219) +Defined in: [hotkey-manager.ts:221](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L221) *** @@ -107,7 +107,7 @@ Defined in: [hotkey-manager.ts:219](https://github.com/TanStack/hotkeys/blob/mai lastKeyTime: number; ``` -Defined in: [hotkey-manager.ts:225](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L225) +Defined in: [hotkey-manager.ts:227](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L227) `Date.now()` when the last step in the current attempt matched @@ -119,7 +119,7 @@ Defined in: [hotkey-manager.ts:225](https://github.com/TanStack/hotkeys/blob/mai options: HotkeySequenceOptions; ``` -Defined in: [hotkey-manager.ts:199](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L199) +Defined in: [hotkey-manager.ts:201](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L201) Resolved options for this registration @@ -137,7 +137,7 @@ RegistrationBase.options parsedSequence: ParsedHotkeyChord[]; ``` -Defined in: [hotkey-manager.ts:221](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L221) +Defined in: [hotkey-manager.ts:223](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L223) *** @@ -147,7 +147,7 @@ Defined in: [hotkey-manager.ts:221](https://github.com/TanStack/hotkeys/blob/mai target: Target; ``` -Defined in: [hotkey-manager.ts:201](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L201) +Defined in: [hotkey-manager.ts:203](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L203) The resolved target element for this registration @@ -165,7 +165,7 @@ RegistrationBase.target triggerCount: number; ``` -Defined in: [hotkey-manager.ts:203](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L203) +Defined in: [hotkey-manager.ts:205](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L205) How many times this registration's callback has been triggered diff --git a/docs/reference/interfaces/HotkeySequenceRegistrationView.md b/docs/reference/interfaces/HotkeySequenceRegistrationView.md index 6722627e1..d7f04db58 100644 --- a/docs/reference/interfaces/HotkeySequenceRegistrationView.md +++ b/docs/reference/interfaces/HotkeySequenceRegistrationView.md @@ -5,7 +5,7 @@ title: HotkeySequenceRegistrationView -Defined in: [hotkey-manager.ts:261](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L261) +Defined in: [hotkey-manager.ts:263](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L263) Public view of a sequence registration, without its callback. @@ -21,7 +21,7 @@ Public view of a sequence registration, without its callback. hasFired: boolean; ``` -Defined in: [hotkey-manager.ts:249](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L249) +Defined in: [hotkey-manager.ts:251](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L251) #### Inherited from @@ -37,7 +37,7 @@ RegistrationViewBase.hasFired hotkey: HotkeySequence; ``` -Defined in: [hotkey-manager.ts:263](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L263) +Defined in: [hotkey-manager.ts:265](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L265) *** @@ -47,7 +47,7 @@ Defined in: [hotkey-manager.ts:263](https://github.com/TanStack/hotkeys/blob/mai id: string; ``` -Defined in: [hotkey-manager.ts:244](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L244) +Defined in: [hotkey-manager.ts:246](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L246) #### Inherited from @@ -63,7 +63,7 @@ RegistrationViewBase.id kind: "sequence"; ``` -Defined in: [hotkey-manager.ts:262](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L262) +Defined in: [hotkey-manager.ts:264](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L264) *** @@ -73,7 +73,7 @@ Defined in: [hotkey-manager.ts:262](https://github.com/TanStack/hotkeys/blob/mai matchedStepCount: number; ``` -Defined in: [hotkey-manager.ts:267](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L267) +Defined in: [hotkey-manager.ts:269](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L269) Steps matched in the current attempt (0 when idle or just completed). @@ -85,7 +85,7 @@ Steps matched in the current attempt (0 when idle or just completed). options: HotkeySequenceOptions; ``` -Defined in: [hotkey-manager.ts:265](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L265) +Defined in: [hotkey-manager.ts:267](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L267) *** @@ -95,7 +95,7 @@ Defined in: [hotkey-manager.ts:265](https://github.com/TanStack/hotkeys/blob/mai parsedSequence: ParsedHotkeyChord[]; ``` -Defined in: [hotkey-manager.ts:264](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L264) +Defined in: [hotkey-manager.ts:266](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L266) *** @@ -105,7 +105,7 @@ Defined in: [hotkey-manager.ts:264](https://github.com/TanStack/hotkeys/blob/mai partialMatchLastKeyTime: number; ``` -Defined in: [hotkey-manager.ts:269](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L269) +Defined in: [hotkey-manager.ts:271](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L271) `Date.now()` when the last step in the current attempt matched; 0 if none. @@ -117,7 +117,7 @@ Defined in: [hotkey-manager.ts:269](https://github.com/TanStack/hotkeys/blob/mai status: HotkeyRegistrationStatus; ``` -Defined in: [hotkey-manager.ts:246](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L246) +Defined in: [hotkey-manager.ts:248](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L248) Whether the registration is enabled and in an active scope. @@ -135,7 +135,7 @@ RegistrationViewBase.status target: Target; ``` -Defined in: [hotkey-manager.ts:247](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L247) +Defined in: [hotkey-manager.ts:249](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L249) #### Inherited from @@ -151,7 +151,7 @@ RegistrationViewBase.target triggerCount: number; ``` -Defined in: [hotkey-manager.ts:248](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L248) +Defined in: [hotkey-manager.ts:250](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L250) #### Inherited from diff --git a/docs/reference/type-aliases/HotkeyCommonOptions.md b/docs/reference/type-aliases/HotkeyCommonOptions.md index 58b53e3b5..55fec0c90 100644 --- a/docs/reference/type-aliases/HotkeyCommonOptions.md +++ b/docs/reference/type-aliases/HotkeyCommonOptions.md @@ -9,7 +9,7 @@ title: HotkeyCommonOptions type HotkeyCommonOptions = HotkeyChordOptions & HotkeySequenceOptions; ``` -Defined in: [hotkey-manager.ts:179](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L179) +Defined in: [hotkey-manager.ts:181](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L181) Chord and sequence options together, for options applied to hotkeys of either kind. Each option applies only to the kinds that support it. diff --git a/docs/reference/type-aliases/HotkeyOptionsFor.md b/docs/reference/type-aliases/HotkeyOptionsFor.md index aad608c48..2aa163111 100644 --- a/docs/reference/type-aliases/HotkeyOptionsFor.md +++ b/docs/reference/type-aliases/HotkeyOptionsFor.md @@ -9,7 +9,7 @@ title: HotkeyOptionsFor type HotkeyOptionsFor = [T] extends [never] ? HotkeyCommonOptions : T extends readonly [RegisterableHotkeyChord] ? HotkeyChordOptions : T extends RegisterableHotkeySequence ? HotkeySequenceOptions : HotkeyChordOptions; ``` -Defined in: [hotkey-manager.ts:185](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L185) +Defined in: [hotkey-manager.ts:187](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L187) The options type for a hotkey: chord options for chords (including one-step tuples), sequence options for sequences. diff --git a/docs/reference/type-aliases/HotkeyRecorderOptions.md b/docs/reference/type-aliases/HotkeyRecorderOptions.md index b0c7ca8af..1c2482be0 100644 --- a/docs/reference/type-aliases/HotkeyRecorderOptions.md +++ b/docs/reference/type-aliases/HotkeyRecorderOptions.md @@ -11,7 +11,7 @@ type HotkeyRecorderOptions = | HotkeySequenceRecorderOptions; ``` -Defined in: [hotkey-recorder.ts:231](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L231) +Defined in: [hotkey-recorder.ts:239](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L239) Options for HotkeyRecorder. `maxSteps` (default 1) selects between recording a single chord and recording a sequence. diff --git a/docs/reference/type-aliases/HotkeyRegistration.md b/docs/reference/type-aliases/HotkeyRegistration.md index f8f13f8bd..eeee1bc8c 100644 --- a/docs/reference/type-aliases/HotkeyRegistration.md +++ b/docs/reference/type-aliases/HotkeyRegistration.md @@ -11,6 +11,6 @@ type HotkeyRegistration = | HotkeySequenceRegistration; ``` -Defined in: [hotkey-manager.ts:229](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L229) +Defined in: [hotkey-manager.ts:231](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L231) A registered hotkey in the HotkeyManager. diff --git a/docs/reference/type-aliases/HotkeyRegistrationStatus.md b/docs/reference/type-aliases/HotkeyRegistrationStatus.md index 8c9bf718a..e8104df98 100644 --- a/docs/reference/type-aliases/HotkeyRegistrationStatus.md +++ b/docs/reference/type-aliases/HotkeyRegistrationStatus.md @@ -9,7 +9,7 @@ title: HotkeyRegistrationStatus type HotkeyRegistrationStatus = "active" | "suspended" | "disabled"; ``` -Defined in: [hotkey-manager.ts:241](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L241) +Defined in: [hotkey-manager.ts:243](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L243) Whether a registration is on. Focus isn't checked: a registration on an element also needs focus inside that element to fire. diff --git a/docs/reference/type-aliases/HotkeyRegistrationView.md b/docs/reference/type-aliases/HotkeyRegistrationView.md index 3d0279e49..8bb7a2cb5 100644 --- a/docs/reference/type-aliases/HotkeyRegistrationView.md +++ b/docs/reference/type-aliases/HotkeyRegistrationView.md @@ -11,7 +11,7 @@ type HotkeyRegistrationView = | HotkeySequenceRegistrationView; ``` -Defined in: [hotkey-manager.ts:276](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L276) +Defined in: [hotkey-manager.ts:278](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L278) Public view of a hotkey registration for display and introspection. Narrow with `kind` to read chord- or sequence-specific fields. diff --git a/e2e/README.md b/e2e/README.md index 2f51f9cce..516f5c657 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -35,6 +35,9 @@ These tests run every framework adapter in a real browser. Each adapter has a sm - A sequence fires. - The recorder records a chord. - Key hold and held keys follow the keyboard. +- An element-targeted hotkey keeps firing after its element moves into a popup window and back. + +Two more tests run only for apps with a `portal` entry in `adapters/apps.ts`. In Solid, a `Portal` whose `mount` switches to a popup window keeps its hotkey without registering again. In React and Preact, a hotkey in a portal whose container joins the page after the hotkey registers still runs after the framework's `onKeyDown`, which can stop it. React also runs everything under `StrictMode` (`?strict`), which mounts, unmounts and remounts each effect. Preact's `StrictMode` is a Fragment, so its `?strict` run matches the plain one. diff --git a/e2e/adapters/adapters.spec.ts b/e2e/adapters/adapters.spec.ts index ba5ff8b90..6a7c3b9dc 100644 --- a/e2e/adapters/adapters.spec.ts +++ b/e2e/adapters/adapters.spec.ts @@ -115,6 +115,110 @@ for (const app of adapterApps) { await expect(page.locator('#held-keys')).toHaveText('') }) + // A popup from `window.open` is a real second window, as when an app + // moves a panel into a pop-out or Document Picture-in-Picture window. + test('an element hotkey follows its element into a popup window and back', async ({ + page, + openApp, + }) => { + const fixture = await openApp(app) + await expect.poll(() => fixture.registrationsOf('L')).toHaveLength(1) + const popup = await fixture.openPopup() + await page.evaluate(() => { + const host = document.getElementById('element-host')! + // Kept so the element goes back where the framework rendered it + ;(window as { hostPlace?: [Node, Node | null] }).hostPlace = [ + host.parentNode!, + host.nextSibling, + ] + window.fixturePopup!.document.body.append(host) + }) + await popup.locator('#element-host').focus() + await popup.keyboard.press('l') + expect(await fixture.takeLog()).toEqual(['element hotkey']) + + await page.evaluate(() => { + const [parent, next] = (window as { hostPlace?: [Node, Node | null] }) + .hostPlace! + const host = + window.fixturePopup!.document.getElementById('element-host')! + parent.insertBefore(host, next) + }) + await page.bringToFront() + await page.focus('#element-host') + await page.keyboard.press('l') + expect(await fixture.takeLog()).toEqual(['element hotkey']) + }) + + // The TanStack Devtools Picture-in-Picture case: the framework moves the + // same nodes to the new mount, and the hotkey doesn't register again. + if (app.portal === 'movable') { + test('a hotkey in a portal keeps firing after the portal mounts in a popup window and back', async ({ + page, + openApp, + }) => { + const fixture = await openApp(app) + await expect.poll(() => fixture.registrationsOf('P')).toHaveLength(1) + const ids = await fixture.registrationIdsOf('P') + await page.focus('#portal-host') + await page.keyboard.press('p') + expect(await fixture.takeLog()).toEqual(['portal hotkey']) + + // Playwright's Firefox doesn't focus an element in the popup that + // still had focus in this page when it moved there. + await page.evaluate(() => + (document.activeElement as HTMLElement).blur(), + ) + const popup = await fixture.openPopup() + await fixture.portalInto('popup') + await expect(popup.locator('#portal-host')).toHaveCount(1) + await expect(page.locator('#portal-host')).toHaveCount(0) + await popup.locator('#portal-host').focus() + await popup.keyboard.press('p') + expect(await fixture.takeLog()).toEqual(['portal hotkey']) + expect(await fixture.registrationIdsOf('P')).toEqual(ids) + + await fixture.portalInto('page') + await expect(page.locator('#portal-host')).toHaveCount(1) + await page.bringToFront() + await page.focus('#portal-host') + await page.keyboard.press('p') + expect(await fixture.takeLog()).toEqual(['portal hotkey']) + expect(await fixture.registrationIdsOf('P')).toEqual(ids) + }) + } + + // The effects inside the portal run before the parent's, so its hotkeys + // register while the container is outside the page. React handles the + // child's key events from a listener on the container; Preact listens on + // the child itself. + if (app.portal === 'detached') { + test('a hotkey in a portal registered before its container is in the page runs after the framework key handler', async ({ + page, + openApp, + }) => { + const fixture = await openApp(app) + await expect.poll(() => fixture.registrationsOf('P')).toHaveLength(1) + await expect + .poll(() => fixture.registrationsOf('Shift+P')) + .toHaveLength(1) + await page.focus('#portal-child') + await page.keyboard.press('p') + expect(await fixture.takeLog()).toEqual([ + 'portal keydown', + 'portal hotkey', + ]) + // The handler stops Shift+P before it reaches the hotkey + await page.keyboard.press('Shift+P') + expect(await fixture.takeLog()).toEqual(['portal keydown']) + await page.keyboard.press('p') + expect(await fixture.takeLog()).toEqual([ + 'portal keydown', + 'portal hotkey', + ]) + }) + } + // Playwright can't turn on the OS Caps Lock: Chromium and WebKit report // it off. This checks that real input reaches the lock state helper. test('key lock state follows real input and resets on blur', async ({ diff --git a/e2e/adapters/apps.ts b/e2e/adapters/apps.ts index c6c0f82fd..af860b10e 100644 --- a/e2e/adapters/apps.ts +++ b/e2e/adapters/apps.ts @@ -18,18 +18,33 @@ export interface AdapterApp { * title, each with its GitHub issue, such as `{ 'a sequence…': '#123' }`. */ knownBugs?: Record + /** + * The portal this app renders, for a framework that has one (see + * `shared/fixture.ts`). + */ + portal?: 'movable' | 'detached' } export const adapterApps: Array = [ - { name: 'react', folder: 'react' }, + { name: 'react', folder: 'react', portal: 'detached' }, // StrictMode mounts, unmounts and remounts every effect once in development - { name: 'react (StrictMode)', folder: 'react', query: '?strict' }, - { name: 'preact', folder: 'preact' }, + { + name: 'react (StrictMode)', + folder: 'react', + query: '?strict', + portal: 'detached', + }, + { name: 'preact', folder: 'preact', portal: 'detached' }, // Preact's StrictMode is a Fragment: it doesn't double-mount. Kept so the // Preact app runs the same tree as React's. - { name: 'preact (StrictMode)', folder: 'preact', query: '?strict' }, + { + name: 'preact (StrictMode)', + folder: 'preact', + query: '?strict', + portal: 'detached', + }, { name: 'vue', folder: 'vue' }, - { name: 'solid', folder: 'solid' }, + { name: 'solid', folder: 'solid', portal: 'movable' }, { name: 'svelte', folder: 'svelte' }, { name: 'angular', folder: 'angular' }, { name: 'lit', folder: 'lit' }, @@ -67,6 +82,10 @@ async function serveApps(page: Page): Promise { /** Typed access to the app's `window.fixture`. */ function fixtureFor(page: Page) { + const registrationsOf = async (hotkey: string) => + (await page.evaluate(() => window.fixture!.registrations())).filter( + (registration) => registration.hotkey === hotkey, + ) const call = ( method: TKey, arg: Parameters[0], @@ -82,6 +101,24 @@ function fixtureFor(page: Page) { setEnabled: (enabled: boolean) => call('setEnabled', enabled), setHotkey: (hotkey: string) => call('setHotkey', hotkey), startRecording: () => page.evaluate(() => window.fixture!.startRecording()), + /** + * Opens an empty popup window from the page, kept as + * `window.fixturePopup`. + */ + openPopup: async (): Promise => { + const opened = page.waitForEvent('popup') + await page.evaluate(() => { + window.fixturePopup = window.open('', 'popup', 'width=400,height=300')! + }) + return opened + }, + /** Mounts the movable portal in the popup, or back in the page. */ + portalInto: (where: 'popup' | 'page') => + page.evaluate((intoPopup) => { + window.fixture!.portalInto!( + intoPopup ? window.fixturePopup!.document : null, + ) + }, where === 'popup'), /** Names logged by callbacks, in order. Clears the log. */ takeLog: () => page.evaluate(() => window.fixture!.log.splice(0)), recorded: () => page.evaluate(() => window.fixture!.recorded), @@ -90,10 +127,14 @@ function fixtureFor(page: Page) { /** Registrations of one hotkey, such as `K` or `G G`. */ registrationsOf: async ( hotkey: string, - ): Promise> => - (await page.evaluate(() => window.fixture!.registrations())).filter( - (registration) => registration.hotkey === hotkey, - ), + ): Promise>> => + (await registrationsOf(hotkey)).map(({ hotkey, enabled }) => ({ + hotkey, + enabled, + })), + /** The manager's ids for one hotkey's registrations. */ + registrationIdsOf: async (hotkey: string): Promise> => + (await registrationsOf(hotkey)).map(({ id }) => id), } } diff --git a/e2e/adapters/apps/alpine/index.html b/e2e/adapters/apps/alpine/index.html index e4170f812..a255221a8 100644 --- a/e2e/adapters/apps/alpine/index.html +++ b/e2e/adapters/apps/alpine/index.html @@ -16,6 +16,7 @@ id="caps-lock" x-text="capsLock.value === null ? 'unknown' : capsLock.value ? 'on' : 'off'" > +
diff --git a/e2e/adapters/apps/alpine/src/main.ts b/e2e/adapters/apps/alpine/src/main.ts index a183b3fee..16753bccc 100644 --- a/e2e/adapters/apps/alpine/src/main.ts +++ b/e2e/adapters/apps/alpine/src/main.ts @@ -27,8 +27,13 @@ Alpine.data('app', () => { shiftHeld: scope.createKeyHold('Shift'), capsLock: scope.createKeyLockState('CapsLock'), heldKeys: scope.createHeldKeys(), - init(this: AppData) { + init(this: AppData & { $refs: Record }) { scope.createHotkey(['G', 'G'], () => logCall('sequence')) + scope.createHotkey( + 'L', + () => logCall('element hotkey'), + () => ({ target: this.$refs.elementHost }), + ) exposeFixture( { getHotkeyManager, detectPlatform }, { diff --git a/e2e/adapters/apps/angular/src/main.ts b/e2e/adapters/apps/angular/src/main.ts index 5824746b4..fe3a84f3b 100644 --- a/e2e/adapters/apps/angular/src/main.ts +++ b/e2e/adapters/apps/angular/src/main.ts @@ -1,6 +1,9 @@ import '@angular/compiler' import { Component, + Directive, + ElementRef, + inject, provideZonelessChangeDetection, signal, } from '@angular/core' @@ -38,9 +41,20 @@ const HotkeyHost = Component({ }, ) +// Listens on the element it's applied to +const ElementHotkey = Directive({ selector: '[elementHotkey]' })( + class ElementHotkey { + constructor() { + injectHotkey('L', () => logCall('element hotkey'), { + target: inject(ElementRef), + }) + } + }, +) + const App = Component({ selector: 'app-root', - imports: [HotkeyHost], + imports: [HotkeyHost, ElementHotkey], template: ` @if (shown()) { @@ -49,6 +63,7 @@ const App = Component({
{{ shiftHeld() ? 'held' : 'released' }}
{{ heldKeys().join('+') }}
{{ capsLock() === null ? 'unknown' : capsLock() ? 'on' : 'off' }}
+
`, })( class App { diff --git a/e2e/adapters/apps/ember/app/templates/application.gts b/e2e/adapters/apps/ember/app/templates/application.gts index cbecadedd..e4a0ba343 100644 --- a/e2e/adapters/apps/ember/app/templates/application.gts +++ b/e2e/adapters/apps/ember/app/templates/application.gts @@ -3,6 +3,7 @@ import { tracked } from '@glimmer/tracking' import { detectPlatform, getHotkeyManager, + onHotkey, useHeldKeys, useHotkey, useHotkeyRecorder, @@ -32,6 +33,7 @@ class App extends Component { sequence = ['G', 'G'] as const onSequence = () => logCall('sequence') + onElementHotkey = () => logCall('element hotkey') recorder = useHotkeyRecorder(this, { onRecord: setRecorded }) shiftHeld = useKeyHold(this, 'Shift') capsLock = useKeyLockState(this, 'CapsLock') @@ -68,6 +70,7 @@ class App extends Component {
{{if this.shiftHeld.value 'held' 'released'}}
{{this.heldKeysText}}
{{this.capsLockText}}
+
} diff --git a/e2e/adapters/apps/lit/src/main.ts b/e2e/adapters/apps/lit/src/main.ts index 886e76aa0..11f68a7fb 100644 --- a/e2e/adapters/apps/lit/src/main.ts +++ b/e2e/adapters/apps/lit/src/main.ts @@ -8,6 +8,7 @@ import { getHotkeyManager, } from '@tanstack/lit-hotkeys' import { LitElement, html } from 'lit' +import { createRef, ref } from 'lit/directives/ref.js' import { exposeFixture, logCall, setRecorded } from '../../../shared/fixture' import type { Hotkey } from '@tanstack/lit-hotkeys' @@ -59,6 +60,7 @@ class FixtureApp extends LitElement { shiftHeld = new KeyHoldController(this, 'Shift') capsLock = new KeyLockStateController(this, 'CapsLock') heldKeys = new HeldKeysController(this) + elementHost = createRef() constructor() { super() @@ -66,6 +68,12 @@ class FixtureApp extends LitElement { this.enabled = true this.hotkey = 'K' new HotkeyController(this, ['G', 'G'], () => logCall('sequence')) + new HotkeyController( + this, + 'L', + () => logCall('element hotkey'), + () => ({ target: this.elementHost.value }), + ) } protected override createRenderRoot() { @@ -100,6 +108,7 @@ class FixtureApp extends LitElement {
${this.capsLock.value === null ? 'unknown' : this.capsLock.value ? 'on' : 'off'}
+
` } } diff --git a/e2e/adapters/apps/octane/src/main.tsrx b/e2e/adapters/apps/octane/src/main.tsrx index ce02575c1..9993aad59 100644 --- a/e2e/adapters/apps/octane/src/main.tsrx +++ b/e2e/adapters/apps/octane/src/main.tsrx @@ -1,4 +1,4 @@ -import { createRoot, useEffect, useState } from 'octane' +import { createRoot, useEffect, useRef, useState } from 'octane' import { detectPlatform, getHotkeyManager, @@ -25,6 +25,8 @@ function App() @{ const shiftHeld = useKeyHold('Shift') const heldKeys = useHeldKeys() const capsLock = useKeyLockState('CapsLock') + const elementHost = useRef(null) + useHotkey('L', () => logCall('element hotkey'), { target: elementHost }) useEffect(() => { exposeFixture({ getHotkeyManager, detectPlatform }, { @@ -41,6 +43,7 @@ function App() @{
{shiftHeld ? 'held' : 'released'}
{heldKeys.join('+')}
{capsLock === null ? 'unknown' : capsLock ? 'on' : 'off'}
+
} diff --git a/e2e/adapters/apps/preact/src/main.tsx b/e2e/adapters/apps/preact/src/main.tsx index 779f06478..b5f34013e 100644 --- a/e2e/adapters/apps/preact/src/main.tsx +++ b/e2e/adapters/apps/preact/src/main.tsx @@ -4,12 +4,13 @@ import { useHeldKeys, useHotkey, useHotkeyRecorder, + useHotkeys, useKeyHold, useKeyLockState, } from '@tanstack/preact-hotkeys' import { render } from 'preact' -import { StrictMode } from 'preact/compat' -import { useEffect, useState } from 'preact/hooks' +import { StrictMode, createPortal } from 'preact/compat' +import { useEffect, useRef, useState } from 'preact/hooks' import { exposeFixture, logCall, setRecorded } from '../../../shared/fixture' import type { Hotkey } from '@tanstack/preact-hotkeys' @@ -18,6 +19,41 @@ function HotkeyHost({ hotkey, enabled }: { hotkey: string; enabled: boolean }) { return
} +function PortalHost() { + const ref = useRef(null) + useHotkeys( + [ + { hotkey: 'P', callback: () => logCall('portal hotkey') }, + { hotkey: 'Shift+P', callback: () => logCall('portal hotkey') }, + ], + { target: ref }, + ) + return ( +
+ { + if (event.key.toLowerCase() !== 'p') return + logCall('portal keydown') + if (event.shiftKey) event.stopPropagation() + }} + /> +
+ ) +} + +// The container joins the page in this component's effect, which runs after +// the effects inside the portal. +function DetachedPortal() { + const [container] = useState(() => document.createElement('div')) + useEffect(() => { + document.body.append(container) + return () => container.remove() + }, [container]) + return createPortal(, container) +} + function App() { const [shown, setShown] = useState(true) const [enabled, setEnabled] = useState(true) @@ -27,6 +63,8 @@ function App() { const shiftHeld = useKeyHold('Shift') const heldKeys = useHeldKeys() const capsLock = useKeyLockState('CapsLock') + const elementHost = useRef(null) + useHotkey('L', () => logCall('element hotkey'), { target: elementHost }) useEffect(() => { exposeFixture( @@ -49,6 +87,8 @@ function App() {
{capsLock === null ? 'unknown' : capsLock ? 'on' : 'off'}
+
+ ) } diff --git a/e2e/adapters/apps/react/src/main.tsx b/e2e/adapters/apps/react/src/main.tsx index d367bb2b7..4ea91da27 100644 --- a/e2e/adapters/apps/react/src/main.tsx +++ b/e2e/adapters/apps/react/src/main.tsx @@ -4,10 +4,12 @@ import { useHeldKeys, useHotkey, useHotkeyRecorder, + useHotkeys, useKeyHold, useKeyLockState, } from '@tanstack/react-hotkeys' -import { StrictMode, useEffect, useState } from 'react' +import { StrictMode, useEffect, useRef, useState } from 'react' +import { createPortal } from 'react-dom' import { createRoot } from 'react-dom/client' import { exposeFixture, logCall, setRecorded } from '../../../shared/fixture' import type { Hotkey } from '@tanstack/react-hotkeys' @@ -17,6 +19,41 @@ function HotkeyHost({ hotkey, enabled }: { hotkey: string; enabled: boolean }) { return
} +function PortalHost() { + const ref = useRef(null) + useHotkeys( + [ + { hotkey: 'P', callback: () => logCall('portal hotkey') }, + { hotkey: 'Shift+P', callback: () => logCall('portal hotkey') }, + ], + { target: ref }, + ) + return ( +
+ { + if (event.key.toLowerCase() !== 'p') return + logCall('portal keydown') + if (event.shiftKey) event.stopPropagation() + }} + /> +
+ ) +} + +// The container joins the page in this component's effect, which runs after +// the effects inside the portal. +function DetachedPortal() { + const [container] = useState(() => document.createElement('div')) + useEffect(() => { + document.body.append(container) + return () => container.remove() + }, [container]) + return createPortal(, container) +} + function App() { const [shown, setShown] = useState(true) const [enabled, setEnabled] = useState(true) @@ -26,6 +63,8 @@ function App() { const shiftHeld = useKeyHold('Shift') const heldKeys = useHeldKeys() const capsLock = useKeyLockState('CapsLock') + const elementHost = useRef(null) + useHotkey('L', () => logCall('element hotkey'), { target: elementHost }) useEffect(() => { exposeFixture( @@ -48,6 +87,8 @@ function App() {
{capsLock === null ? 'unknown' : capsLock ? 'on' : 'off'}
+
+ ) } diff --git a/e2e/adapters/apps/solid/src/main.tsx b/e2e/adapters/apps/solid/src/main.tsx index 897e91e8c..4699daa6c 100644 --- a/e2e/adapters/apps/solid/src/main.tsx +++ b/e2e/adapters/apps/solid/src/main.tsx @@ -1,4 +1,4 @@ -import { render } from '@solidjs/web' +import { Portal, render } from '@solidjs/web' import { createHeldKeys, createHotkey, @@ -21,6 +21,16 @@ function HotkeyHost(props: { hotkey: string; enabled: boolean }) { return
} +function PortalHost() { + const [host, setHost] = createSignal(null) + createHotkey( + 'P', + () => logCall('portal hotkey'), + () => ({ target: host() }), + ) + return
+} + function App() { const [shown, setShown] = createSignal(true) const [enabled, setEnabled] = createSignal(true) @@ -30,6 +40,16 @@ function App() { const shiftHeld = createKeyHold('Shift') const capsLock = createKeyLockState('CapsLock') const heldKeys = createHeldKeys() + const [elementHost, setElementHost] = createSignal( + null, + ) + createHotkey( + 'L', + () => logCall('element hotkey'), + () => ({ target: elementHost() }), + ) + // Changing the mount moves the same nodes there + const [portalMount, setPortalMount] = createSignal(document.body) onSettled(() => { exposeFixture( @@ -39,6 +59,7 @@ function App() { setEnabled, setHotkey, startRecording: () => recorder.startRecording(), + portalInto: (target) => setPortalMount((target ?? document).body), }, ) }) @@ -54,6 +75,10 @@ function App() {
{capsLock() === null ? 'unknown' : capsLock() ? 'on' : 'off'}
+
+ + + ) } diff --git a/e2e/adapters/apps/svelte/src/App.svelte b/e2e/adapters/apps/svelte/src/App.svelte index 8b410f632..44eeb7586 100644 --- a/e2e/adapters/apps/svelte/src/App.svelte +++ b/e2e/adapters/apps/svelte/src/App.svelte @@ -1,6 +1,7 @@ diff --git a/docs/framework/vue/guides/custom-hotkey-recording.md b/docs/framework/vue/guides/custom-hotkey-recording.md index b130448d4..c87e1cff1 100644 --- a/docs/framework/vue/guides/custom-hotkey-recording.md +++ b/docs/framework/vue/guides/custom-hotkey-recording.md @@ -113,8 +113,10 @@ watchEffect((onCleanup) => { const onPointerDown = (event: PointerEvent) => { if (!button.value?.contains(event.target as Node)) cancelRecording() } - document.addEventListener('pointerdown', onPointerDown, true) - onCleanup(() => document.removeEventListener('pointerdown', onPointerDown, true)) + // The button's document, which can be a Picture-in-Picture window + const doc = button.value?.ownerDocument ?? document + doc.addEventListener('pointerdown', onPointerDown, true) + onCleanup(() => doc.removeEventListener('pointerdown', onPointerDown, true)) }) ``` diff --git a/docs/reference/classes/HotkeyManager.md b/docs/reference/classes/HotkeyManager.md index e20e9f77b..5893b58bd 100644 --- a/docs/reference/classes/HotkeyManager.md +++ b/docs/reference/classes/HotkeyManager.md @@ -5,7 +5,7 @@ title: HotkeyManager -Defined in: [hotkey-manager.ts:627](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L627) +Defined in: [hotkey-manager.ts:628](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L628) ## Properties @@ -15,7 +15,7 @@ Defined in: [hotkey-manager.ts:627](https://github.com/TanStack/hotkeys/blob/mai readonly appHotkeys: Store; ``` -Defined in: [hotkey-manager.ts:654](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L654) +Defined in: [hotkey-manager.ts:655](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L655) The app hotkeys store published by a framework provider, so tools such as devtools can list declared hotkeys that are not registered. @@ -28,7 +28,7 @@ devtools can list declared hotkeys that are not registered. readonly registrations: Store>; ``` -Defined in: [hotkey-manager.ts:647](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L647) +Defined in: [hotkey-manager.ts:648](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L648) The TanStack Store containing all hotkey registrations, chords and sequences. Use this to subscribe to registration changes or access current registrations. @@ -57,7 +57,7 @@ for (const [id, reg] of manager.registrations.state) { readonly scopes: Store; ``` -Defined in: [hotkey-manager.ts:657](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L657) +Defined in: [hotkey-manager.ts:658](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L658) Active scopes. Subscribe to show which hotkeys are suspended. @@ -69,7 +69,7 @@ Active scopes. Subscribe to show which hotkeys are suspended. activateScope(scope, options?): () => void; ``` -Defined in: [hotkey-manager.ts:774](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L774) +Defined in: [hotkey-manager.ts:775](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L775) Activates a scope until the returned function is called. Activations are counted, so a scope stays active until every activation is released. @@ -113,7 +113,7 @@ manager.activateScope('dialog', { exclusive: { allow: ['global'] } }) destroy(): void; ``` -Defined in: [hotkey-manager.ts:2137](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2137) +Defined in: [hotkey-manager.ts:2138](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2138) Destroys the manager and removes all listeners. @@ -129,7 +129,7 @@ Destroys the manager and removes all listeners. getRegistrationCount(): number; ``` -Defined in: [hotkey-manager.ts:2069](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2069) +Defined in: [hotkey-manager.ts:2070](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2070) Gets the number of registered hotkeys, chords and sequences. @@ -145,7 +145,7 @@ Gets the number of registered hotkeys, chords and sequences. hasActiveRegistration(hotkey): boolean; ``` -Defined in: [hotkey-manager.ts:2107](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2107) +Defined in: [hotkey-manager.ts:2108](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2108) Checks whether a hotkey can fire now: at least one registration is enabled, in an active scope, and listening where key presses go. A @@ -179,7 +179,7 @@ True if a registration that can fire exists isRegistered(hotkey, target?): boolean; ``` -Defined in: [hotkey-manager.ts:2080](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2080) +Defined in: [hotkey-manager.ts:2081](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2081) Checks if a specific hotkey is registered. @@ -211,7 +211,7 @@ True if a matching registration exists isScopeActive(scope?): boolean; ``` -Defined in: [hotkey-manager.ts:813](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L813) +Defined in: [hotkey-manager.ts:814](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L814) Whether hotkeys in a scope can fire: the scope is `'global'` or activated, and either no scope is exclusive or this scope is the @@ -239,7 +239,7 @@ register( ): HotkeyRegistrationHandle>; ``` -Defined in: [hotkey-manager.ts:1031](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L1031) +Defined in: [hotkey-manager.ts:1032](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L1032) Registers a hotkey handler and returns a handle for updating the registration. @@ -305,7 +305,7 @@ handle.unregister() resetSequenceProgress(): void; ``` -Defined in: [hotkey-manager.ts:2054](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2054) +Defined in: [hotkey-manager.ts:2055](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2055) Resets the progress of every in-progress sequence. @@ -321,7 +321,7 @@ Resets the progress of every in-progress sequence. suspendCharacterKeys(): () => void; ``` -Defined in: [hotkey-manager.ts:840](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L840) +Defined in: [hotkey-manager.ts:841](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L841) Suspends document-level character key shortcuts until you call the returned function, so apps can let users turn off single-key shortcuts for @@ -357,7 +357,7 @@ resume() static getInstance(): HotkeyManager; ``` -Defined in: [hotkey-manager.ts:742](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L742) +Defined in: [hotkey-manager.ts:743](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L743) Gets the singleton instance of HotkeyManager. @@ -373,7 +373,7 @@ Gets the singleton instance of HotkeyManager. static resetInstance(): void; ``` -Defined in: [hotkey-manager.ts:749](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L749) +Defined in: [hotkey-manager.ts:750](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L750) Resets the singleton instance. Useful for testing. diff --git a/docs/reference/classes/HotkeyRecorder.md b/docs/reference/classes/HotkeyRecorder.md index d0c62ea68..984bf6ef0 100644 --- a/docs/reference/classes/HotkeyRecorder.md +++ b/docs/reference/classes/HotkeyRecorder.md @@ -99,7 +99,7 @@ Defined in: [hotkey-recorder.ts:292](https://github.com/TanStack/hotkeys/blob/ma cancel(): void; ``` -Defined in: [hotkey-recorder.ts:610](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L610) +Defined in: [hotkey-recorder.ts:611](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L611) Cancel recording without saving. @@ -118,7 +118,7 @@ the onCancel callback if provided. commit(): void; ``` -Defined in: [hotkey-recorder.ts:511](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L511) +Defined in: [hotkey-recorder.ts:512](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L512) Commits the recorded steps after validation and conflict checks. Called automatically at `maxSteps`, on Enter, or after `idleTimeoutMs`. @@ -136,7 +136,7 @@ A rejected commit leaves recording active with its steps intact. destroy(): void; ``` -Defined in: [hotkey-recorder.ts:623](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L623) +Defined in: [hotkey-recorder.ts:624](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L624) Clean up event listeners and reset state. @@ -197,7 +197,7 @@ and records chords according to `maxSteps`. stop(): void; ``` -Defined in: [hotkey-recorder.ts:600](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L600) +Defined in: [hotkey-recorder.ts:601](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-recorder.ts#L601) Stop recording (same as cancel, but doesn't call onCancel). diff --git a/docs/reference/functions/getHotkeyManager.md b/docs/reference/functions/getHotkeyManager.md index 19c10a799..c321b0a27 100644 --- a/docs/reference/functions/getHotkeyManager.md +++ b/docs/reference/functions/getHotkeyManager.md @@ -9,7 +9,7 @@ title: getHotkeyManager function getHotkeyManager(): HotkeyManager; ``` -Defined in: [hotkey-manager.ts:2158](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2158) +Defined in: [hotkey-manager.ts:2159](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L2159) Gets the singleton HotkeyManager instance. Convenience function for accessing the manager. diff --git a/docs/reference/interfaces/ActivateHotkeyScopeOptions.md b/docs/reference/interfaces/ActivateHotkeyScopeOptions.md index b3f4ac615..b4cc00ca6 100644 --- a/docs/reference/interfaces/ActivateHotkeyScopeOptions.md +++ b/docs/reference/interfaces/ActivateHotkeyScopeOptions.md @@ -5,7 +5,7 @@ title: ActivateHotkeyScopeOptions -Defined in: [hotkey-manager.ts:574](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L574) +Defined in: [hotkey-manager.ts:575](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L575) Options for `HotkeyManager.activateScope`. @@ -21,7 +21,7 @@ optional exclusive?: }; ``` -Defined in: [hotkey-manager.ts:581](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L581) +Defined in: [hotkey-manager.ts:582](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L582) Suspend every other scope, including `'global'`, until this activation is released. Scopes nested in this one stay active. Pass `{ allow }` to keep @@ -36,7 +36,7 @@ still has to be activated, except `'global'`. optional parent?: string; ``` -Defined in: [hotkey-manager.ts:587](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L587) +Defined in: [hotkey-manager.ts:588](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L588) The scope this one is nested in. A nested scope takes precedence over its ancestors even when it was activated first, as nested providers are when diff --git a/docs/reference/interfaces/HotkeyScopesState.md b/docs/reference/interfaces/HotkeyScopesState.md index 00c924278..db2f95ecc 100644 --- a/docs/reference/interfaces/HotkeyScopesState.md +++ b/docs/reference/interfaces/HotkeyScopesState.md @@ -5,7 +5,7 @@ title: HotkeyScopesState -Defined in: [hotkey-manager.ts:547](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L547) +Defined in: [hotkey-manager.ts:548](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L548) Active hotkey scopes, published on `HotkeyManager.scopes`. @@ -17,7 +17,7 @@ Active hotkey scopes, published on `HotkeyManager.scopes`. active: readonly string[]; ``` -Defined in: [hotkey-manager.ts:552](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L552) +Defined in: [hotkey-manager.ts:553](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L553) Activated scopes, lowest precedence first. `'global'` is always active and not listed. @@ -30,7 +30,7 @@ and not listed. allowed: readonly string[]; ``` -Defined in: [hotkey-manager.ts:559](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L559) +Defined in: [hotkey-manager.ts:560](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L560) Scopes the exclusive scope allows that are active, possibly including `'global'`. Empty when no scope is exclusive. @@ -43,7 +43,7 @@ Scopes the exclusive scope allows that are active, possibly including characterKeysSuspended: boolean; ``` -Defined in: [hotkey-manager.ts:570](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L570) +Defined in: [hotkey-manager.ts:571](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L571) Whether character key shortcuts, such as `K` or `Shift+/`, are suspended by `suspendCharacterKeys`. Hotkeys on an element other than the body or the @@ -57,7 +57,7 @@ root element are not suspended. exclusive: string | null; ``` -Defined in: [hotkey-manager.ts:554](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L554) +Defined in: [hotkey-manager.ts:555](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L555) The exclusive scope that owns the keyboard, or `null` when none is active. @@ -69,7 +69,7 @@ The exclusive scope that owns the keyboard, or `null` when none is active. suspended: readonly string[]; ``` -Defined in: [hotkey-manager.ts:564](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L564) +Defined in: [hotkey-manager.ts:565](https://github.com/TanStack/hotkeys/blob/main/packages/hotkeys/src/hotkey-manager.ts#L565) Scopes that are active but cannot fire because another scope is exclusive, possibly including `'global'`. diff --git a/package.json b/package.json index 1f3975e34..98588d4f1 100644 --- a/package.json +++ b/package.json @@ -188,7 +188,7 @@ "ignore": [ "lit" ], - "limit": "10 KB" + "limit": "10.25 KB" }, { "name": "Alpine createHotkeysScope + hotkeysPlugin", diff --git a/packages/hotkeys/src/hotkey-manager.ts b/packages/hotkeys/src/hotkey-manager.ts index e0fc4b0c4..e3ea756a7 100644 --- a/packages/hotkeys/src/hotkey-manager.ts +++ b/packages/hotkeys/src/hotkey-manager.ts @@ -497,9 +497,10 @@ function movesAfterDelegatedHandlers(options: HotkeyOptions): boolean { /** * When an element target checks whether it moved. Focus enters the element * before a key press there, so the new window's listeners are in place before - * that press starts. Key events cover presses dispatched without focus. + * that press starts. `focus` covers a page that stops `focusin`, and key + * events cover presses dispatched without focus. */ -const FOLLOW_EVENTS = ['focusin', 'keydown', 'keyup'] as const +const FOLLOW_EVENTS = ['focus', 'focusin', 'keydown', 'keyup'] as const function followsRoot({ target, diff --git a/packages/hotkeys/src/hotkey-recorder.ts b/packages/hotkeys/src/hotkey-recorder.ts index 7b95b6419..2fd19c9c3 100644 --- a/packages/hotkeys/src/hotkey-recorder.ts +++ b/packages/hotkeys/src/hotkey-recorder.ts @@ -378,9 +378,10 @@ export class HotkeyRecorder { : target.defaultView // A closed window, or a document without one, sends no key events. if (!view || view.closed) return - this.#view = view // Ending a recording cleared its idle timer and events beginRecording(this, view) + // After beginRecording: another recorder's onCancel can stop this one + this.#view = view this.store.setState(() => ({ ...INITIAL_RECORDER_STATE, isRecording: true, diff --git a/packages/hotkeys/tests/delegated-handlers.test.ts b/packages/hotkeys/tests/delegated-handlers.test.ts index 267dd7ad4..71a85ffac 100644 --- a/packages/hotkeys/tests/delegated-handlers.test.ts +++ b/packages/hotkeys/tests/delegated-handlers.test.ts @@ -410,6 +410,24 @@ describe('afterDelegatedHandlers after the target moves', () => { ]) }) + it('moves its listener on focus when the page stops focusin', () => { + const { panel, child } = panelWithChild() + register('hotkey', panel) + const other = frameDocument() + other.body.append(panel) + other.addEventListener('focusin', (event) => event.stopPropagation(), true) + const addNew = vi.spyOn(other, 'addEventListener') + cleanups.push(() => addNew.mockRestore()) + + child.dispatchEvent(new FocusEvent('focusin', { bubbles: true })) + child.dispatchEvent(new FocusEvent('focus')) + + expect(addNew.mock.calls.map(([type]) => type)).toEqual([ + 'keydown', + 'keyup', + ]) + }) + it('keeps following for the hotkeys left on an element after one unregisters', () => { const { panel, child } = panelWithChild() const k = register('K', panel) @@ -426,6 +444,7 @@ describe('afterDelegatedHandlers after the target moves', () => { expect( remove.mock.calls.map(([type, , capture]) => [type, capture]), ).toEqual([ + ['focus', true], ['focusin', true], ['keydown', true], ['keyup', true], diff --git a/packages/hotkeys/tests/recorder-window.test.ts b/packages/hotkeys/tests/recorder-window.test.ts index 23e991ff8..08edbd3b1 100644 --- a/packages/hotkeys/tests/recorder-window.test.ts +++ b/packages/hotkeys/tests/recorder-window.test.ts @@ -201,4 +201,26 @@ describe('HotkeyRecorder with a target window', () => { keydown({ key: 'k', code: 'KeyK', target: document.body }) expect(hotkey).toHaveBeenCalledTimes(1) }) + + it("stops listening in its window when another recorder's onCancel stops it while it starts", () => { + const view = otherWindow() + const onRecord = vi.fn() + const second = createRecorder({ onRecord, target: view }) + createRecorder({ + onRecord: vi.fn(), + onCancel: () => second.stop(), + }).start() + second.start() + second.stop() + // Recording again elsewhere must not hear the first window + second.setOptions({ target: undefined }) + second.start() + keydown({ + key: 's', + code: 'KeyS', + metaKey: true, + target: view.document.body, + }) + expect(onRecord).not.toHaveBeenCalled() + }) }) From 0575d631387ae4ec78532b46718ba47fa7529b07 Mon Sep 17 00:00:00 2001 From: Kevin Van Cott Date: Sat, 28 Nov 2026 09:05:55 -0600 Subject: [PATCH 3/3] docs(lit): Remove the outside-click listener from the document it was added to --- .intent/review-state.json | 10 +++++----- .../lit/guides/custom-hotkey-recording.md | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.intent/review-state.json b/.intent/review-state.json index 74ffbacd7..8f6b7df13 100644 --- a/.intent/review-state.json +++ b/.intent/review-state.json @@ -7375,15 +7375,15 @@ ] }, "source:docs/framework/lit/guides/custom-hotkey-recording.md": { - "fingerprint": "ce392febf357e4770ccfce7caa958d476c2a31a4f54b9f1029feddf1786b54c5", + "fingerprint": "81a4250128dd2ccbfef1591530b35991a0b5a81d90dd7657cc5fc3afbd3f5a98", "snapshot": { - "docs/framework/lit/guides/custom-hotkey-recording.md": "16f966a7da579db2bf27a61a62688a184ef5ba12e957716767d65f8715eb8544" + "docs/framework/lit/guides/custom-hotkey-recording.md": "f0452e0e1a15debe0cca111e509bd5d837806e838d0a3863d8474ddca33b1c13" }, - "head": "3339f06c3651c133a2314b979c1d4d3615c43a86", + "head": "264669937b5f362e29c77cfc7e9a6aa6ca24fe1a", "outcome": "no-change", - "reason": "Review fixes: follow on focus too, keep the recorder window when another recorder stops it, guides listen for outside clicks in the button's document. No skill teaches these, so no guidance changes", + "reason": "Lit guide example keeps the document its outside-click listener is on; no skill covers it", "evidence": [ - "Changed: docs/framework/lit/guides/custom-hotkey-recording.md at 3339f06c3651c133a2314b979c1d4d3615c43a86" + "Changed: docs/framework/lit/guides/custom-hotkey-recording.md at 264669937b5f362e29c77cfc7e9a6aa6ca24fe1a" ] }, "source:docs/framework/lit/reference/functions/hotkey.md": { diff --git a/docs/framework/lit/guides/custom-hotkey-recording.md b/docs/framework/lit/guides/custom-hotkey-recording.md index 002e1e976..9cbc448d6 100644 --- a/docs/framework/lit/guides/custom-hotkey-recording.md +++ b/docs/framework/lit/guides/custom-hotkey-recording.md @@ -115,18 +115,25 @@ private onPointerDown = (event: PointerEvent) => { if (!event.composedPath().includes(this)) this.recorder.cancelRecording() } +// The document the listener is on, kept in case the element moves +private listeningIn: Document | null = null + +private stopListening() { + this.listeningIn?.removeEventListener('pointerdown', this.onPointerDown, true) + this.listeningIn = null +} + updated() { + if (!this.recorder.isRecording) return this.stopListening() + if (this.listeningIn) return // The element's document, which can be a Picture-in-Picture window - if (this.recorder.isRecording) { - this.ownerDocument.addEventListener('pointerdown', this.onPointerDown, true) - } else { - this.ownerDocument.removeEventListener('pointerdown', this.onPointerDown, true) - } + this.listeningIn = this.ownerDocument + this.listeningIn.addEventListener('pointerdown', this.onPointerDown, true) } disconnectedCallback() { super.disconnectedCallback() - this.ownerDocument.removeEventListener('pointerdown', this.onPointerDown, true) + this.stopListening() } ```