Replies: 1 comment
|
+1, with a concrete case for bubble phase. We use A proposed shape, with the default matching today's behavior: interface HotkeyOptions {
/** Listen in the capture phase instead of the bubble phase. @default false */
capture?: boolean
}One implementation detail: a single target could then have both capture-phase and bubble-phase registrations. So We're running this as a local patch against 0.9.0. If the maintainers are open to the option, we'd be glad to open a PR with tests, docs and a changeset. (Related: #115 moves |
Uh oh!
There was an error while loading. Please reload this page.
Backgroud
element.addEventListener('type', callback, { capture: true })https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#capture
current @tanstack/react-hotkeys simply call
element.addEventListener(type, callback)https://github.com/TanStack/hotkeys/blob/%40tanstack/vue-hotkeys%400.4.1/packages/hotkeys/src/hotkey-manager.ts#L396-L397
sometimes it matters for
capturebecause it will trigger before any bubble stage listeners.Feature Request
add
options.capture: booleantoUseHotKeyOptionsOther Libraries
options.useCaptureAll reactions