dmauro / Keypress

A keyboard input capturing utility in which any key can be a modifier key.
http://dmauro.github.io/Keypress/
Apache License 2.0
3.18k stars 313 forks source link

Right Alt triggers Left Ctrl in Windows on Polish keyboard #25

Closed tiye closed 10 years ago

tiye commented 10 years ago

We received reports on the mis-triggered events of Right Alt key when using some non-US keyboard, for exmaple, Germen, Polish. After we look into the details, we found that Right Alt key also tirggers Left Ctrl key, whose keyCode is 17 with keyIdentifier of Control.

The bug can be reproduced on Windows 7 Chrome, Polish programmer keyboard, pressing Right Alt.

There's related issue on StackOverflow: http://stackoverflow.com/questions/7090898/right-alt-key-also-triggers-windows-message-for-left-control-key

It's probably a bug of Windows. But in Keypress people may also encounter this problem.

Mithgol commented 10 years ago

It's not a bug, it's a feature. That “right Alt” is actually the AltGr key of these keyboards. On Windows it is equivalent to Ctrl+Alt.

tiye commented 10 years ago

@Mithgol For our specific case, we binded Ctrl Alt x to prevent Ctrl x from triggering. Since it's not a bug, I wil close this issue.

But is there any common solutions for binding Ctrl x(or whatever) in a browser that work well?

Mithgol commented 10 years ago

I have always thought that is_solitary option of Keypress is a solution, i.e. Ctrl+X is triggered when only Ctrl and X are pressed and no other keys are pressed at the same time.

But that's what I've thought from reading the manual, I've never tested it myself.

dmauro commented 10 years ago

Yes, thank you, Mithgol. If I'm reading your problem correctly, making your meta + x keyboard combo a solitary combo will ensure that it won't fire when that right alt key is pressed in conjunction with the x key on German and Polish keyboards.