react-hotkeys
react-hotkeys copied to clipboard
[BUG] Pressing the spacebar with no element focused breaks the event listeners
Describe the bug
Pressing the spacebar breaks the event listeners for a bit if nothing is focused. When focusing on an element pressing spacebar doesn't break react-hotkeys. I'm using the HotKeys component
Expected behavior Pressing the spacebar should work as expected and not break react-hotkeys
Platform (please complete the following information):
- Version of react-hotkeys 2.0.0
- Browser: chrome and firefox developer
- OS: mac os
Include the smallest log that includes your issue:
HotKeys (F20๐-C0๐บ-P0๐บ:) Focused.
FocusOnlyKeyEventStrategy.js:153
HotKeys (F20๐-E303๐-C0๐บ-P0๐บ:) New ' ' keydown event. FocusOnlyKeyEventStrategy.js:298
HotKeys (F20๐-E303๐-C0๐บ-P0๐บ:) No matching actions found for ' ' keydown. AbstractKeyEventStrategy.js:429
HotKeys (F20๐-E305๐งก-C0๐บ-P0๐บ:) New (simulated) ' ' keypress event. FocusOnlyKeyEventStrategy.js:298
HotKeys (F20๐-E305๐งก-C0๐บ-P0๐บ:) Ignored ' ' keypress as it was not expected, and has already been simulated. FocusOnlyKeyEventStrategy.js:339
HotKeys (F20๐-E305๐งก-Cnull๐บ) Stopping further event propagation.
Try the react-hotkeys-ce package on npm. It has the latest code from this repo and most probably contains a fix for this.
Try the react-hotkeys-ce package on npm. It has the latest code from this repo and most contains a fix for this.
Thank you @nopol10 !!!! I was about to have to abandon a feature I had been working on for weeks because of this bug, and then I tried what you suggested and it fixed all the problems.