v2.0.0-pre7
Pre-releasePotentially breaking changes
react-hotkeys
now ignores key combination submatches #186 by default.
This resolves the issue of when an application has a context-dependent action, bound to a short key combination (e.g.?
) and a longer global action bound to a longer key combination (e.g. shift+?
), and the longer key combination is hidden behind the shorter one and never triggered whenever a child of the component that defines the shorter combination is in focus (#161, #181, #175).
If you would like the old behaviour, you can re-enable submatches with the allowCombinationSubmatches
configuration option:
configure({
allowCombinationSubmatches: true,
})
For a full description of what this change means, and the tradeoffs, see the How combinations and sequences are matched section of the Readme.
Bugfixes
- Fix bug that prevented binding to keydown and key for the same key combination #166
New features
HotKeys root prop
A new root
prop is now available for HotKeys
that allows placing HotKeys
components at the root of the app without actually defining any key maps or handlers, to ensure all key events are recorded (#188):
<HotKeys root>
//... application
</HotKeys>
For details of when you may want to use this, see the React Hotkeys thinks I'm holding down a key I've released section of the readme.
GlobalHotKeys report missed keyboard events
GlobalHotKeys
components now report key events that may have been missed by HotKeys
, to avoid hanging key combinations when an action handler changes focus outside of the part of the React app below the highest HotKeys
component.
Again, you can see the React Hotkeys thinks I'm holding down a key I've released section of the readme for more details.