How to handle ctrl+arrow in Javascript?
- by MartyIX
I've noticed an problem when trying to catch keyboard shortcut: CTRL+an arrow.
I've handled keydown event. Now when I hold CTRL key then keydown event is fired once. If I hold an arrow (so that now I'm holding CTRL+an arrow) it doesn't fire another event. Is it forbidden from any reason? I guess I've already encountered this problem in Opera a few years ago and there was an option for it in browser.
My results:
holding CTRL, press an arrow -- fires event for CTRL and doesn't fire an event for an arrow
press CTRL + an arrow at once -- fires one event but only with keycode of CTRL.
holding CTRL, press a letter (eg. S) -- works as expected
press CTRL + letter (eg. S) -- works as expected
(Results are identical in Chrome and Firefox. Is the behaviour described above a standard?)
I'm using:
function OnKeyDown(e) { }
e.ctrlKey, e.which properties of event
The question is: what might be the problem?