I am developing an application where I need to do some post-processing when the user presses CMD+LEFT on a particular text-box. I need to do this a
This is known behavior with the meta key, and there is unfortunately no known workaround.
For your case, you may consider implementing the default browser behavior yourself (how to do that), then implement the custom behavior you need, and finish it off with _e.preventDefault();
don't think you'll need a settimeout.
i've changed the code to detect 2 keydowns. this can be refactored further to a cleaner code.
http://jsfiddle.net/7nd7hf16/1/
var cmdDown = false;
$('#foo')
.keydown(function(_e) {
if(_e.keyCode == 91)
cmdDown = true;
if(cmdDown && _e.keyCode == 37)
console.log('cmd + left');
console.log('Keydown: ' + _e.keyCode);
})
.keyup(function(_e) {
if(_e.keyCode == 91)
cmdDown = false;
console.log('Keyup: ' + _e.keyCode);
})
.focus();
This is almost certainly to do with system set 'hot keys'.Apparently according to the docs this missing keyup event is expected behaviour too.
When i do cmdspace i dont even get a keydown event for the space as the spotlight window appears.
On your mention of the ctrl key: because i have 'spaces' set up when i ctrlleft or ctrlright i get no left or right keydown events fired, however ctrlup or ctrldown at least fire their keydown events.
I think it would be difficult to assume the use of a system that does not have the "default" hot keys setup.