npm / react-hotkeys-hook
react-hotkeys-hook
What changed in react-hotkeys-hook 4 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-25.
13 breaking15 new APIs and options2 behavior and defaults2 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initreact-hotkeys-hook 510 changes
Breaking changes 7
The HotkeysProvider context value enabledScopes has been renamed to activeScopes.
The HotkeysProvider option enabledScopes has been renamed to activeScopes.
CommonJS support has been dropped; the package is now ESM-only. Use a bundler to handle conversion if CommonJS is needed.
Special character mappings to the German keyboard layout code have been removed.
useHotkeys listens to physical key codes rather than produced characters by default; useHotkeys('!', callback) no longer works unless useKey is enabled.
The option formerly named splitKey is now delimiter and specifies the character that separates different hotkey combinations.
The option formerly named combinationKey is now splitKey and specifies the character that joins keys within a combination.
New APIs and options 1
Set useKey to true to listen to the produced key rather than the code; it defaults to false.
Behavior and default changes 1
If all scopes are disabled in HotkeysProvider, no hotkeys will be active.
Fixes and other changes 1
Listening to control instead of ctrl now triggers correctly.
react-hotkeys-hook 422 changes
Breaking changes 6
The cmd hotkey is no longer available; use meta instead.
combinationKey replaces splitKey for separating keys in a combination and still defaults to +.
The command hotkey is no longer available; use meta instead.
enableOnFormTags replaces enableOnTags.
filter merges into enabled.
splitKey now separates keystrokes and defaults to ,.
New APIs and options 14
Deactivates the given scope.
enabled accepts a Trigger: a boolean or a function receiving keyboardEvent and hotkeysEvent to determine whether the option should trigger.
Returns the active scopes; defaults to ['*'] for wildcard.
enableOnTags accepts a boolean; true enables all form tags, and the default is false.
Activates the given scope.
Returns an array of all currently bound hotkeys through useHotkeysContext.
Wrap the app in HotkeysProvider to use scopes.
The first argument accepts an array or string to check whether a key or combination of keys is currently pressed.
Accepts a splitKey string to separate hotkeys when the first argument is a string.
preventDefault accepts a Trigger to determine whether to call e.preventDefault() internally; it defaults to false.
Set one or more scopes on a hotkey; the hotkey is active only when a matching scope is activated.
Toggles the given scope.
The first argument can be an array of hotkey strings.
The hook provides functions and values for managing scopes and accessing currently bound hotkeys.
Behavior and default changes 1
The options object and dependency array can be passed in either order, and either can be omitted.
Fixes and other changes 1
The dependency list is now typed as DependencyList instead of any[].