Releases: JohannesKlauss/react-hotkeys-hook
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>
enabledScopes
in theHotkeysProvider
has been renamed toactiveScopes
- If all scopes are disabled in the
HotkeysProvider
no 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
splitKey
option has been renamed todelimiter
- The
combinationKey
option has been renamed todelimiter
- 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
control
instead ofctrl
wouldn't trigger correctly
Migration Guide
- If you are using the
splitKey
option, rename that todelimiter
- If you are using the
combinationKey
option, 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 layout
New 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
v.5.0.0-1
🎉 First stable Pre Release for 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>
enabledScopes
in theHotkeysProvider
has been renamed toactiveScopes
- If all scopes are disabled in the
HotkeysProvider
no 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
splitKey
option has been renamed todelimiter
- The
combinationKey
option has been renamed todelimiter
- 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
control
instead ofctrl
wouldn't trigger correctly
Migration Guide
- If you are using the
splitKey
option, rename that todelimiter
- If you are using the
combinationKey
option, 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 layout
v4.5.0
What's Changed
- Added clean keys while recording by @DmitriiAlekseenko in #1129
New Contributors
- @DmitriiAlekseenko made their first contribution in #1129
Full Changelog: v4.4.4...v4.5.0
v4.4.4
v4.4.3
What's Changed
- Call ignoreEventWhen callback only on hotkey matches by @LuanScudeler in #1096
- Fix CI (update triggers, format files) by @kachkaev in #1105
- fix: focus trap did not work for shadow root by @artchen-db in #1108
- chore(deps): update dependency typescript to v5.3.3 by @renovate in #1106
- chore(deps): update dependency @testing-library/user-event to v14.5.2 by @renovate in #1097
- chore(deps): update dependency tslib to v2.6.2 by @renovate in #1102
- chore(deps): update dependency @testing-library/react to v14.1.2 by @renovate in #1094
- chore(deps): update react monorepo by @renovate in #1093
- chore(deps): update dependency @types/jest to v29.5.11 by @renovate in #1092
- chore(deps): update babel monorepo by @renovate in #1091
New Contributors
- @artchen-db made their first contribution in #1108
Full Changelog: v4.4.2...v4.4.3