Skip to content

Add Key Blacklist Support to useRecordHotkeys#1268

Merged
JohannesKlauss merged 5 commits into
JohannesKlauss:mainfrom
vedmakk:feature/RecordingBlacklist
May 1, 2026
Merged

Add Key Blacklist Support to useRecordHotkeys#1268
JohannesKlauss merged 5 commits into
JohannesKlauss:mainfrom
vedmakk:feature/RecordingBlacklist

Conversation

@vedmakk
Copy link
Copy Markdown
Contributor

@vedmakk vedmakk commented Jun 13, 2025

This PR enhances the useRecordHotkeys hook by adding support for blacklisting specific keys during the recording phase.

As discussed in #1267 .

The hook now accepts an optional second parameter — an array of key names to exclude from recording:

const [keys, { start, stop, isRecording }] = useRecordHotkeys(false, ['tab', 'enter'])
  • Keys in the blacklist are ignored during recording (not added to the set).
  • Their default browser behavior is preserved.
  • Fully backwards compatible.

Changes

  • Enhanced useRecordHotkeys.ts with key blacklist support and refactored start/stop logic for more reliable event listener management.
  • Added tests in useRecordHotkeys.test.tsx to cover the blacklist behavior.
  • Updated documentation with usage examples and API updates.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-hotkeys-hook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 13, 2025 7:19am

@JohannesKlauss
Copy link
Copy Markdown
Owner

Sorry for the late response. There seems to be an issue with your package-lock.json. As far as I see there should be no updates in it. Can you please check on that @vedmakk

@dex1e
Copy link
Copy Markdown

dex1e commented Oct 29, 2025

@vedmakk This is a really useful feature. Please fix the package-lock.json.

@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 31, 2025

@vedmakk is attempting to deploy a commit to the Johannes Klauss' projects Team on Vercel.

A member of the Team first needs to authorize it.

@vedmakk
Copy link
Copy Markdown
Contributor Author

vedmakk commented Oct 31, 2025

Sorry for the late response. There seems to be an issue with your package-lock.json. As far as I see there should be no updates in it. Can you please check on that @vedmakk

You are right. I reverted the package-lock.json.

@JohannesKlauss JohannesKlauss merged commit af836f6 into JohannesKlauss:main May 1, 2026
1 check failed
@vedmakk
Copy link
Copy Markdown
Contributor Author

vedmakk commented May 1, 2026

Today is a good day!

mergify Bot pushed a commit to doxynix/doxynix that referenced this pull request May 4, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [@tanstack/eslint-plugin-query](https://tanstack.com/query) ([source](https://redirect.github.com/TanStack/query/tree/HEAD/packages/eslint-plugin-query)) | [`5.100.6` → `5.100.7`](https://renovatebot.com/diffs/npm/@tanstack%2feslint-plugin-query/5.100.6/5.100.7) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@tanstack%2feslint-plugin-query/5.100.7?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@tanstack%2feslint-plugin-query/5.100.6/5.100.7?slim=true) |
| [@tanstack/react-query](https://tanstack.com/query) ([source](https://redirect.github.com/TanStack/query/tree/HEAD/packages/react-query)) | [`5.100.6` → `5.100.7`](https://renovatebot.com/diffs/npm/@tanstack%2freact-query/5.100.6/5.100.7) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@tanstack%2freact-query/5.100.7?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@tanstack%2freact-query/5.100.6/5.100.7?slim=true) |
| [@tanstack/react-query-devtools](https://tanstack.com/query) ([source](https://redirect.github.com/TanStack/query/tree/HEAD/packages/react-query-devtools)) | [`5.100.6` → `5.100.7`](https://renovatebot.com/diffs/npm/@tanstack%2freact-query-devtools/5.100.6/5.100.7) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@tanstack%2freact-query-devtools/5.100.7?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@tanstack%2freact-query-devtools/5.100.6/5.100.7?slim=true) |
| [react-hotkeys-hook](https://react-hotkeys-hook.vercel.app/) ([source](https://redirect.github.com/JohannesKlauss/react-keymap-hook)) | [`5.2.4` → `5.3.0`](https://renovatebot.com/diffs/npm/react-hotkeys-hook/5.2.4/5.3.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/react-hotkeys-hook/5.3.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-hotkeys-hook/5.2.4/5.3.0?slim=true) |

---

### Release Notes

<details>
<summary>TanStack/query (@&#8203;tanstack/eslint-plugin-query)</summary>

### [`v5.100.7`](https://redirect.github.com/TanStack/query/blob/HEAD/packages/eslint-plugin-query/CHANGELOG.md#51007)

[Compare Source](https://redirect.github.com/TanStack/query/compare/@tanstack/eslint-plugin-query@5.100.6...@tanstack/eslint-plugin-query@5.100.7)

</details>

<details>
<summary>TanStack/query (@&#8203;tanstack/react-query)</summary>

### [`v5.100.7`](https://redirect.github.com/TanStack/query/blob/HEAD/packages/react-query/CHANGELOG.md#51007)

[Compare Source](https://redirect.github.com/TanStack/query/compare/@tanstack/react-query@5.100.6...@tanstack/react-query@5.100.7)

##### Patch Changes

- Updated dependencies \[]:
  - [@&#8203;tanstack/query-core](https://redirect.github.com/tanstack/query-core)@&#8203;5.100.7

</details>

<details>
<summary>TanStack/query (@&#8203;tanstack/react-query-devtools)</summary>

### [`v5.100.7`](https://redirect.github.com/TanStack/query/blob/HEAD/packages/react-query-devtools/CHANGELOG.md#51007)

[Compare Source](https://redirect.github.com/TanStack/query/compare/@tanstack/react-query-devtools@5.100.6...@tanstack/react-query-devtools@5.100.7)

##### Patch Changes

- docs(devtools): align logo, panel, and 'buttonPosition' union descriptions across docs and JSDoc ([#&#8203;10617](https://redirect.github.com/TanStack/query/pull/10617))

- Updated dependencies \[]:
  - [@&#8203;tanstack/query-devtools](https://redirect.github.com/tanstack/query-devtools)@&#8203;5.100.7
  - [@&#8203;tanstack/react-query](https://redirect.github.com/tanstack/react-query)@&#8203;5.100.7

</details>

<details>
<summary>JohannesKlauss/react-keymap-hook (react-hotkeys-hook)</summary>

### [`v5.3.0`](https://redirect.github.com/JohannesKlauss/react-hotkeys-hook/releases/tag/v5.3.0)

[Compare Source](https://redirect.github.com/JohannesKlauss/react-keymap-hook/compare/v5.2.4...v5.3.0)

#### What's Changed

- chore(deps): update dependency vite to v7.3.2 \[security] by [@&#8203;renovate](https://redirect.github.com/renovate)\[bot] in [JohannesKlauss/react-hotkeys-hook#1321](https://redirect.github.com/JohannesKlauss/react-hotkeys-hook/pull/1321)
- fix: prevent mod hotkey from triggering on Super/Windows key on non-macOS platforms by [@&#8203;samhoseinkhani](https://redirect.github.com/samhoseinkhani) in [JohannesKlauss/react-hotkeys-hook#1325](https://redirect.github.com/JohannesKlauss/react-hotkeys-hook/pull/1325)
- Update all non-major dependencies by [@&#8203;renovate](https://redirect.github.com/renovate)\[bot] in [JohannesKlauss/react-hotkeys-hook#1326](https://redirect.github.com/JohannesKlauss/react-hotkeys-hook/pull/1326)
- [#&#8203;1313](https://redirect.github.com/JohannesKlauss/react-keymap-hook/issues/1313) Fixed missing `ref` re-assignment for conditionally rendered elements by [@&#8203;oleksandr-danylchenko](https://redirect.github.com/oleksandr-danylchenko) in [JohannesKlauss/react-hotkeys-hook#1314](https://redirect.github.com/JohannesKlauss/react-hotkeys-hook/pull/1314)
- Add Key Blacklist Support to useRecordHotkeys by [@&#8203;vedmakk](https://redirect.github.com/vedmakk) in [JohannesKlauss/react-hotkeys-hook#1268](https://redirect.github.com/JohannesKlauss/react-hotkeys-hook/pull/1268)
- Update dependency [@&#8203;eslint/js](https://redirect.github.com/eslint/js) to v10 by [@&#8203;renovate](https://redirect.github.com/renovate)\[bot] in [JohannesKlauss/react-hotkeys-hook#1327](https://redirect.github.com/JohannesKlauss/react-hotkeys-hook/pull/1327)

#### New Contributors

- [@&#8203;samhoseinkhani](https://redirect.github.com/samhoseinkhani) made their first contribution in [JohannesKlauss/react-hotkeys-hook#1325](https://redirect.github.com/JohannesKlauss/react-hotkeys-hook/pull/1325)
- [@&#8203;oleksandr-danylchenko](https://redirect.github.com/oleksandr-danylchenko) made their first contribution in [JohannesKlauss/react-hotkeys-hook#1314](https://redirect.github.com/JohannesKlauss/react-hotkeys-hook/pull/1314)
- [@&#8203;vedmakk](https://redirect.github.com/vedmakk) made their first contribution in [JohannesKlauss/react-hotkeys-hook#1268](https://redirect.github.com/JohannesKlauss/react-hotkeys-hook/pull/1268)

**Full Changelog**: <JohannesKlauss/react-hotkeys-hook@v5.2.4...v5.3.0>

</details>

---

### Configuration

📅 **Schedule**: (in timezone Europe/Moscow)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://redirect.github.com/renovatebot/renovate).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants