mousetrap
mousetrap copied to clipboard
ctrl+] does not work
Hello I tried binding on 'ctrl+]' but it failed while binding to 'ctrl+[' worked like a charm. I am using firefox 60.0.1 under linux if this might be of any relevance.
I noticed that ctrl+; didn't work but this time in chromium so I peeked into the code of Mousetrap to put some console.log.
Here's the result when adding some log in the function _handleKeyEvent:
When using firefox
ctrl+;
keydown 17
keydown 59
coucou mod+;
59
keyup 59
keyup 17
ctrl+]
keydown 17
keydown 225
keydown 164
keypress 93
keyup 164
keyup 225
keyup 17
On the belgian keyboard ']' must be typed by using 'AltGr' key + the ']' key. As you can see with the lack of "coucou" line the event was not catched.
When using chromium
ctrl+;
keydown 17
keydown 190
keyup 190
keyup 17
For whatever reason the ';' use the keycode 190. Thus it's not catched by mousetrap and the callback is not called.
ctrl+]
keydown 17
keydown 225
keydown 186
coucou mod+;
186
keyup 186
keyup 225
keyup 17
Once again the AltGr key is pressed (keycode 225). This time the event is catched but the combo is considered 'mod+;'
So all in all, I don't know if the bug is in mousetrap or in the way the browsers handle the keyup / keydown / keypress