react-hotkeys icon indicating copy to clipboard operation
react-hotkeys copied to clipboard

[BUG] Pressing the spacebar with no element focused breaks the event listeners

Open juansalvatore opened this issue 3 years ago โ€ข 2 comments

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.

juansalvatore avatar Mar 10 '21 14:03 juansalvatore

Try the react-hotkeys-ce package on npm. It has the latest code from this repo and most probably contains a fix for this.

nopol10 avatar Mar 28 '21 02:03 nopol10

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.

jhyman2 avatar Apr 28 '21 21:04 jhyman2