[BUG] letter combination doesn't work in Windows
Describe the bug A clear and concise description of what the bug is. if I define the key map as this:
const keyMap = {
openDialog: 'a+b',
};
It doesn't work in Chrome/IE11/Edge on Windows environment. On Mac Chrome Version 77.0.3865.90, 'a+b' and 'b+a' will both trigger the same event in handler.
How are you using react hotkeys components? (HotKeys, GlobalHotKeys, IgnoreKeys etc) I'm using HotKeys
Expected behavior A clear and concise description of what you expected to happen.
'a+b' should trigger the event on Windows and Mac correctly.
Platform (please complete the following information):
- Version of react-hotkeys 2.0.0
- Browser [e.g. chrome, safari] IE 11, chrome on Mac and Windows
- OS: [e.g. iOS] Mac OS
Are you willing and able to create a PR request to fix this issue?
APPLICABLE TO v2.0.0-pre1 AND ABOVE: ======================
Include the smallest log that includes your issue:
In windows. After click 'a' the log says it looks for map action and no match. Then log shows a 'a' keyup event without I releasing the key. Then it looks for the 'b' keydown match. So it never finds the combination.
Paste logs in Windows Chrome when I do 'a+b':
HotKeys (F2๐-E9๐-C0๐บ-P0๐บ:) New 'a' keydown event.
AbstractKeyEventStrategy.js?b56c:429 HotKeys (F2๐-E9๐-C0๐บ-P0๐บ:) No matching actions found for 'a' keydown.
FocusOnlyKeyEventStrategy.js?98f4:298 HotKeys (F2๐-E10๐-C0๐บ-P0๐บ:) New 'a' keypress event.
FocusOnlyKeyEventStrategy.js?98f4:298 HotKeys (F2๐-E11๐งก-C0๐บ-P0๐บ:) New 'a' keyup event.
FocusOnlyKeyEventStrategy.js?98f4:298 HotKeys (F2๐-E12โค๏ธ-C0๐บ-P0๐บ:) New 'b' keydown event.
AbstractKeyEventStrategy.js?b56c:429 HotKeys (F2๐-E12โค๏ธ-C0๐บ-P0๐บ:) No matching actions found for 'b' keydown.
FocusOnlyKeyEventStrategy.js?98f4:298 HotKeys (F2๐-E13๐-C0๐บ-P0๐บ:) New 'b' keypress event.
FocusOnlyKeyEventStrategy.js?98f4:298 HotKeys (F2๐-E14๐-C0๐บ-P0๐บ:) New 'b' keyup event.
In Chrome Mac. The key press array is correct. But the order doesn't work properly.
'a+b' log:
New 'a' keydown event.
AbstractKeyEventStrategy.js?b56c:429 HotKeys (F1๐-E1๐-C0๐บ-P0๐บ:) No matching actions found for 'a' keydown.
FocusOnlyKeyEventStrategy.js?98f4:298 HotKeys (F1๐-E2๐-C0๐บ-P0๐บ:) New 'a' keypress event.
FocusOnlyKeyEventStrategy.js?98f4:298 HotKeys (F1๐-E3๐-C0๐บ-P0๐บ:) New 'b' keydown event.
AbstractKeyEventStrategy.js?b56c:418 HotKeys (F1๐-E3๐-C0๐บ-P0๐บ:) Found action that matches 'a+b': openDialog. Calling handler . . .
'b+a' log:
New 'b' keydown event.
AbstractKeyEventStrategy.js?b56c:429 HotKeys (F5๐-E6โค๏ธ-C0๐บ-P0๐บ:) No matching actions found for 'b' keydown.
FocusOnlyKeyEventStrategy.js?98f4:298 HotKeys (F5๐-E7๐-C0๐บ-P0๐บ:) New 'b' keypress event.
FocusOnlyKeyEventStrategy.js?98f4:298 HotKeys (F5๐-E8๐-C0๐บ-P0๐บ:) New 'a' keydown event.
AbstractKeyEventStrategy.js?b56c:418 HotKeys (F5๐-E8๐-C0๐บ-P0๐บ:) Found action that matches 'a+b': openDialog. Calling handler . . .'
Set logging to verbose (you'll need the development build if its possible):
import { configure } from 'react-hotkeys';
configure({
logLevel: 'verbose'
})
What Configuration options are you using?
All default configs.
configure({
//options
})
Hi @Ray-Hong,
Thank you for taking the time to fill out the bug reporting template correctly. That is really helpful.
I can see for the logs that on Windows Chrome, react-hotkeys seems to think you are releasing the a key before you press the b key.
I'll need to investigate this further and find out why on the Windows version of Chrome the keyup native event is being emitted despite you not releasing the key. I am not sure if this something in React or Chrome.
Would you mind telling me what version of React you are using?
Hey @greena13 ,
Thank you for replying. I'm using React 16.8.5. Please let me know if you have any questions.