Releases: JohannesKlauss/react-hotkeys-hook
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
v4.6.1
What's Changed
- Consider custom element when checking if event is by @HJK181 in #1164
- Bump http-proxy-middleware from 2.0.6 to 2.0.7 in /documentation by @dependabot in #1217
- Bump express from 4.19.2 to 4.21.0 in /documentation by @dependabot in #1210
New Contributors
Full Changelog: v4.6.0...v4.6.1
v4.6.0
What's Changed
- chore(deps): update all non-major dependencies by @renovate in #1204
- Feat: Helps to identify which Shortcut was triggered exactly by @prostoandrei in #1219
New Contributors
- @prostoandrei made their first contribution in #1219
Full Changelog: v4.5.1...v4.6.0
v4.5.1
What's Changed
- chore(deps): update all non-major dependencies by @renovate in #1136
- chore(deps): update dependency @types/react to v18.2.56 by @renovate in #1140
- fix: example code in use-hotkeys docs by @jvn4dev in #1142
- chore(deps): update actions/setup-node action to v4 by @renovate in #1141
- chore(deps): update actions/checkout action to v4 by @renovate in #1137
- chore(deps): update all non-major dependencies by @renovate in #1147
- chore(deps): update all non-major dependencies by @renovate in #1149
- chore(deps): update all non-major dependencies by @renovate in #1156
- chore(deps): update all non-major dependencies by @renovate in #1158
- chore(deps): update all non-major dependencies by @renovate in #1162
- chore(deps): update all non-major dependencies by @renovate in #1166
- chore(deps): update dependency @types/react to v18.2.79 by @renovate in #1169
- chore(deps): update all non-major dependencies by @renovate in #1171
- chore(deps): update all non-major dependencies to v7.24.5 by @renovate in #1173
- chore(deps): update dependency @types/react to v18.3.2 by @renovate in #1175
- chore(deps): update all non-major dependencies by @renovate in #1178
- chore(deps): update dependency eslint-plugin-react to v7.34.2 by @renovate in #1182
- chore(deps): update all non-major dependencies by @renovate in #1185
- Fix: example code in is-hotkey-pressed docs by @nakker1218 in #1184
- fix(deps): update dependency clsx to v2 by @renovate in #1174
- chore(deps): update testing-library monorepo (major) - autoclosed by @renovate in #1170
- chore(deps): update typescript-eslint monorepo to v7 (major) by @renovate in #1159
- Bump follow-redirects from 1.15.0 to 1.15.4 in /documentation by @dependabot in #1118
- chore(deps): update all non-major dependencies by @renovate in #1192
- chore(deps): update all non-major dependencies by @renovate in #1196
- Update README.md by @stt045 in #1194
- Bump braces from 3.0.2 to 3.0.3 in /documentation by @dependabot in #1193
- Bump ws from 7.5.7 to 7.5.10 in /documentation by @dependabot in #1191
- Bump webpack-dev-middleware from 5.3.3 to 5.3.4 in /documentation by @dependabot in #1190
- Bump express from 4.18.1 to 4.19.2 in /documentation by @dependabot in #1189
- Bump follow-redirects from 1.15.4 to 1.15.6 in /documentation by @dependabot in #1188
- chore(deps): update all non-major dependencies by @renovate in #1197
- chore(deps): update all non-major dependencies by @renovate in #1199
- Bump ws by @dependabot in #1201
- chore(deps): update typescript-eslint monorepo to v8 (major) by @renovate in #1200
- chore(deps): update all non-major dependencies to v8.0.1 by @renovate in #1202
- Fix default value for mapKey by @nperez0111 in #1124
- React to ref changes by @zeorin in #1132
New Contributors
- @jvn4dev made their first contribution in #1142
- @nakker1218 made their first contribution in #1184
- @stt045 made their first contribution in #1194
- @nperez0111 made their first contribution in #1124
- @zeorin made their first contribution in #1132
Full Changelog: v4.5.0...v4.5.1