Support Command key on OS X
statico opened this issue · comments
Kibo needs support of the meta
modifier so I can avoid trapping useful keystrokes such as Command-R (reload the page).
Thanks for a useful library!
Hi, statico.
I will look into this, as you and others have suggested that I add support for certain keys that I didn't initially consider (because of compatibility or unwanted behaviour such as defaults that couldn't be prevented). Thanks for your feedback!
You can detect meta keys in some browsers but there are some limitations.
Kibo.KEY_NAMES_BY_CODE
and Kibo.MODIFIERS
can be modified to detect meta key codes but I'm afraid that doing that could cause some pollution, specially because the codes aren't the same in every browser.
On my Mac, Firefox detects the key code as 224
, Webkit detects 91
for the left key and 93
for the right one. For Windows keys, some codes are used…
Something like this: 55ac07b
Hey, Nacho!
Supporting the meta
key in a browser-agnostic manner would be awesome indeed. However, given the way I've chosen to do things, one problem that I note in your approach is that there would be multiple overwriting assignments to Kibo.KEY_CODES_BY_NAME.meta
(see the way Kibo.KEY_CODES_BY_NAME
is populated) and that would result in unwanted behaviour.
Thanks for your input!
I've also made a fork that uses cmd for firefox, then lcmd and rcmd for safari/chrome.