Can't match certain hotkeys on Mac
See original GitHub issueFirst of all, thank you for this convenient library!
I faced an issue with one hotkey on Mac, which I believe is somewhat similar to https://github.com/ianstormtaylor/is-hotkey/issues/1
The hotkey is defined as mod+alt+n
. It’s not possible to match it on Mac with isHotkey
/isKeyHotkey
, because in the first case the which
property has the value of 192
(while the expected value is 78
), and in the second, the key
prop has the value of "Dead"
(isKeyHotkey
expects "k"
).
Here’s the keydown event object for cmd+opt+n
:
altKey: true
charCode: 0
code: "KeyN"
composed: true
ctrlKey: false
key: "Dead"
keyCode: 192
metaKey: true
repeat: false
returnValue: true
shiftKey: false
which: 192
What would be the best way to fix this? Is checking the code
prop safe in case key
is "Dead"
?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Change a conflicting keyboard shortcut on Mac - Apple Support
Click Keyboard Shortcuts on the right. A warning icon appears next to conflicting keyboard shortcuts. Double-click the shortcut, then change it. See Use...
Read more >Learn the default keyboard shortcuts in InDesign
*After you select a transformation tool, hold down the mouse button, and then hold down Alt (Windows) or Option (Mac OS) and drag....
Read more >Configure keyboard shortcuts | PyCharm Documentation
To view the keymap configuration, open the Settings/Preferences dialog Ctrl+Alt+S and select Keymap. Keymap settings. PyCharm automatically ...
Read more >Create a custom keyboard shortcut for Word for Mac
On the Tools menu, select Customize Keyboard. To restore keyboard shortcuts to their original state, select Reset All.
Read more >Keyboard Shortcuts and Mouse Actions for Simulink Modeling
On a Mac, press control+left. Change selection to rightmost element relative to cursor. End. On a Mac, press control+right. Select ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @Jacfem, I used a workaround for this specific hotkey. For
mod+alt+n
, instead ofyou could use something like this
@ianstormtaylor looks like checking the
code
property of the event object could indeed work for issues like this. Currently,isCodeHotkey
is an alias forisHotkey
, would you be open for a PR that will eithercode
instead ofwhich
/key
?
Unfortunately no. According to multiple resources, 192 is the code of backtick/grave accent ([1], [2]).
opt+n
inserts˜
and results in a dead key as well (to make things even more confusing,which
is78
in this case)This seems to depend on the layout - the issue is reproducible with
British
,U.S.
, andGerman
but everything works as expected withUnicode Hex input
,Arabic - QWERTY
, andRussian - PC
.I’ll investigate this further tomorrow.