spinningarrow
spinningarrow

Reputation: 2436

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.

Upvotes: 18

Views: 5521

Answers (1)

spinningarrow
spinningarrow

Reputation: 2436

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.

Upvotes: 84

Related Questions