Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
A recent pull request (#186) switched from observing key combination submatches, to ignoring them by default. This revealed there is an issue (#187) with key events being missed by React HotKeys in circumstances where an action is defined with a handler that changes the React DOM or focused element in such a way that the new focused element is outside of any descendants, resulting in the corresponding keyup event never being logged - and react-hotkeys behaving as if the key is still held down.
One possible (partial) solution to this problem was the addition of a
root
prop forHotKeys
components (#187). This has its advantages of not requiring binding to the document, and remaining relatively self-contained. However, it's limited in its scope and not all users can or want to place aHotKeys
component towards the root of their application.This pull request
Allows
GlobalHotKeys
components to report any missed key events toHotKeys
, and to close any hanging key combinations that arise because an action handler changes focus outside of theHotKeys
component before it can register thekeypress
orkeyup
event.