I want to do something when the escape key is pressed by the user on a text field. This code logs 27
whenever the escape key is pressed in the input box in Safari and Firefox, but not in Chrome. I also tried binding to keyup
, not using jQuery (i.e., just using raw JavaScript), and tried using keyCode
instead of which
, none of which helped. Incidentally, Chrome seems to do just fine with all other keys like Enter, the modifier keys, etc. Any idea what's up?
NB: I'm using Chrome 22.0.1229.94 on Mountain Lion.
UPDATE: By the way, if it helps, when I press escape on the input box in Chrome, it loses focus while on the other two browsers it does not.
Finally found what was causing this: the Vimium chrome extension, which catches the Escape key.
A bug has been filed for it here: https://github.com/philc/vimium/issues/499.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With