keithamus / jwerty

⌨ Awesome handling of keyboard events
http://keithamus.github.io/jwerty
Other
1.21k stars 107 forks source link

Minus (-) key doesn't work #59

Open okonet opened 9 years ago

okonet commented 9 years ago

On OS X 10.10 the minus key doesn't work (alone nor with meta keys), for example cmd+- won't fire a callback at all. I've found this gem in the source code: https://github.com/keithamus/jwerty/blob/master/jwerty.js#L186

Not sure why it's here, but removing the comment fixes the issue. Can someone comment on this one?

keithamus commented 9 years ago

hey @okonet thanks for the issue. Special keys on keyboards are difficult, because they don't map to all locales. To make matters worse, some browsers support different keycodes for the - (109 which we support) on your number row vs the - on the numpad (173 which we don't support), while some browsers report it as 189. So it can be wildly different depending on the browser, which sucks.

If you want to make a PR to add all 3 numbers to be - I'll merge it.

okonet commented 9 years ago

I've tested with 189 on Mac OS X 10.10 in Safari 8.0.2 (10600.2.5), Chrome 39.0.2171.95 (64-bit) and Opera 24.0.1558.64. I'm submitting a PR to merge.