Releases: JohannesKlauss/react-hotkeys-hook
v5.3.1
What's Changed
- Bump path-to-regexp from 0.1.12 to 0.1.13 by @dependabot[bot] in #1329
- Bump picomatch by @dependabot[bot] in #1328
- Bump follow-redirects from 1.15.11 to 1.16.0 by @dependabot[bot] in #1330
- Bump svgo from 3.3.2 to 3.3.3 by @dependabot[bot] in #1331
- fix: dynamic enabled option no longer triggers event listeners in v5.3.0 by @JohannesKlauss in #1333
Full Changelog: v5.3.0...v5.3.1
v5.3.2
- The previous release was pointing to a broken entry point
What's Changed
- Bump path-to-regexp from 0.1.12 to 0.1.13 by @dependabot[bot] in #1329
- Bump picomatch by @dependabot[bot] in #1328
- Bump follow-redirects from 1.15.11 to 1.16.0 by @dependabot[bot] in #1330
- Bump svgo from 3.3.2 to 3.3.3 by @dependabot[bot] in #1331
- fix: dynamic enabled option no longer triggers event listeners in v5.3.0 by @JohannesKlauss in #1333
Full Changelog: v5.3.0...v5.3.1
v5.3.0
What's Changed
- chore(deps): update dependency vite to v7.3.2 [security] by @renovate[bot] in #1321
- fix: prevent mod hotkey from triggering on Super/Windows key on non-macOS platforms by @samhoseinkhani in #1325
- Update all non-major dependencies by @renovate[bot] in #1326
- #1313 Fixed missing
refre-assignment for conditionally rendered elements by @oleksandr-danylchenko in #1314 - Add Key Blacklist Support to useRecordHotkeys by @vedmakk in #1268
- Update dependency @eslint/js to v10 by @renovate[bot] in #1327
New Contributors
- @samhoseinkhani made their first contribution in #1325
- @oleksandr-danylchenko made their first contribution in #1314
- @vedmakk made their first contribution in #1268
Full Changelog: v5.2.4...v5.3.0
v5.2.4
- Merge pull request #1312 from JohannesKlauss/revert-1275-main 1197daf
- Revert Regression introduced in "Try to prevent events firing incorrectly when using
useKey: true" 612e549 - Merge pull request #1311 from ShrimpCryptid/feat/clarify-ishotkeypressed-multiple-key-behavior 0219c01
- doc: Updated wording on isHotkeyPressed key argument 9203b7f
- fix: Update documentation for
isHotkeyPressedto describe arguments correctly 154eab9
v5.2.3
What's Changed
- chore(deps): update dependency vite to v7.1.11 [security] by @renovate[bot] in #1296
- feat: add metadata support for hotkeys by @pkulcsarnr in #1299
- chore(deps): update dependency vitest to v4 by @renovate[bot] in #1307
- chore(deps): update actions/setup-node action to v6 by @renovate[bot] in #1306
- chore(deps): update actions/checkout action to v6 by @renovate[bot] in #1305
- fix(deps): update all non-major dependencies by @renovate[bot] in #1304
- Try to prevent events firing incorrectly when using
useKey: trueby @matiastucci in #1275
New Contributors
- @pkulcsarnr made their first contribution in #1299
- @matiastucci made their first contribution in #1275
Full Changelog: v5.2.1...v5.2.3
v5.2.1
v5.2.0
What's Changed
- Added biome as formatter & linter by @JohannesKlauss in #1255
- Update README.md by @iakuraa in #1294
- Include aria roles in ignores by @stutrek in #1291
- Fix missing hotkey prop by @ljani in #1287
- Add more details on
modmodifier by @mickaelzhang in #1293
New Contributors
- @iakuraa made their first contribution in #1294
- @stutrek made their first contribution in #1291
- @ljani made their first contribution in #1287
- @mickaelzhang made their first contribution in #1293
Full Changelog: v5.1.0...v5.2.0
v5.1.0
What's Changed
- chore(deps): update all non-major dependencies by @renovate in #1236
- chore(deps): update all non-major dependencies by @renovate in #1242
- chore(deps): update dependency globals to v16 by @renovate in #1243
- chore(deps): update all non-major dependencies by @renovate in #1248
- Remove explicit 'null' type from useRef uses. by @dbowring in #1249
- Bump vite from 6.2.5 to 6.2.7 by @dependabot in #1246
- chore(deps): update dependency vite to v6.3.4 [security] by @renovate in #1250
- chore(deps): update all non-major dependencies by @renovate in #1251
- feature: sequential combos by @prajjwaldimri in #1247
- chore(deps): update dependency eslint to v9 by @renovate in #1237
New Contributors
- @dbowring made their first contribution in #1249
- @prajjwaldimri made their first contribution in #1247
Full Changelog: v5.0.2...v5.1.0
v5.0.0
🎉 Version 5!
Most users should not need to do any migration, but for those who use special characters (+,-/$? and so on) or a different delimiter key than + there is a bit of work to do.
🚨 Breaking Changes
<HotkeysProvider>
enabledScopesin theHotkeysProviderhas been renamed toactiveScopes- If all scopes are disabled in the
HotkeysProviderno hotkeys will be active
useHotkeys
- The hook now only listens to the code of the hotkey, not the produced key. This will get rid of all the confusion between different keyboard layouts, multiple accidental triggers and so on.
- Special character mappings to the german keyboard layout code have been removed
- The
splitKeyoption has been renamed todelimiter - The
combinationKeyoption has been renamed tosplitKey - New Option
useKey: Setting this to true will listen to the produced key rather than the code. Helpful if you want to listen to something like?,+,!...
🐛 Bugfixes
- Fixed a bug where listening to
controlinstead ofctrlwouldn't trigger correctly
Migration Guide
- If you are using the
splitKeyoption, rename that todelimiter - If you are using the
combinationKeyoption, rename that tosplitKey
If you are listening to special characters like shift+1 in order to listen for the exclamation mark, rewrite your hook like so:
useHotkeys('!', callback, {useKey: true})This will listen to the produced key instead of the code. Listening for shift is not necessary anymore, because the hook will only check if the produced key matches !, no matter how it has been produced. This will be layout agnostic.
If you want to listen to specifically shift+1, then use the hotkey like this:
useHotkeys('shift+1', callback)useKey defaults to false, so you only need to set it, if you want to listen to special characters.
One common use case for this is listening to y and z. On a german layout those keys are swapped. So to comply with every possible keyboard layout, you would set useKey: true to listen to the produced key.
useHotkeys('y', callback, {useKey: true}) // Triggers if the user hits their y key on the keyboard depending on the layout
useHotkeys('y', callback) // Triggers if the user hits the y key implying US keyboard layoutNew Contributors
- @sandstone991 made their first contribution in #1047
Full Changelog: v4.6.2...v5.0.0
v4.6.2
What's Changed
- Update advanced-usage.mdx by @VladimirTambovtsev in #1232
- feature(addEventListener): passthrough event listener options by @wiserockryan in #1234
New Contributors
- @VladimirTambovtsev made their first contribution in #1232
- @wiserockryan made their first contribution in #1234
Full Changelog: v4.6.1...v4.6.2