Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keydown/keyup events not detecting the Escape key being pressed on input text fields in Chrome

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.

like image 345
spinningarrow Avatar asked Oct 17 '12 05:10

spinningarrow


1 Answers

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.

like image 171
spinningarrow Avatar answered Sep 21 '22 05:09

spinningarrow