Describe the bug
Here is the link to sandbox where this bug can be reproduced: [https://codesandbox.io/s/happy-johnson-su7vz]
Steps to reproduce:
1) Focus button and press Shift+Space
2) It writes message to console "(Shift+Space) pressed"
3) Press Shift+Space one more time. It doesn't output anything to console.
4) Refocus element and try to press Shift without space. You can see "(Shift+Space) pressed" in console.
5) Try to press another combination: Shift+R. It doesn't work.
6) If you reload the page and try similar steps with Shift+R combination, everything will work fine.
How are you using react hotkeys components? (HotKeys, GlobalHotKeys, IgnoreKeys etc)
I found out what is causing the issue. It seems Space and Enter key handlers simulate keyPress event even if these two keys can trigger native events. Here is the small program demonstrating which key triggers keyPress event in React. Sandbox
Space and Enter keys produce KeyPress event.
My suggestion is to fix it either in hasKeyPressEvent function (hasKeyPressEvent.js) or remove Space and Enter keys from translateToKey map (translateToKey.js). I prefer the second case.
Describe the bug Here is the link to sandbox where this bug can be reproduced: [https://codesandbox.io/s/happy-johnson-su7vz] Steps to reproduce: 1) Focus button and press Shift+Space 2) It writes message to console "(Shift+Space) pressed" 3) Press Shift+Space one more time. It doesn't output anything to console. 4) Refocus element and try to press Shift without space. You can see "(Shift+Space) pressed" in console. 5) Try to press another combination: Shift+R. It doesn't work. 6) If you reload the page and try similar steps with Shift+R combination, everything will work fine.
How are you using react hotkeys components? (HotKeys, GlobalHotKeys, IgnoreKeys etc)
I found out what is causing the issue. It seems Space and Enter key handlers simulate keyPress event even if these two keys can trigger native events. Here is the small program demonstrating which key triggers keyPress event in React. Sandbox Space and Enter keys produce KeyPress event. My suggestion is to fix it either in hasKeyPressEvent function (hasKeyPressEvent.js) or remove Space and Enter keys from translateToKey map (translateToKey.js). I prefer the second case.