Skip to main content

Bug Tracker

Side navigation

#4556 closed bug (duplicate)

Opened April 17, 2009 06:08PM UTC

Closed April 01, 2011 12:42AM UTC

Last modified March 13, 2012 05:18PM UTC

keypress + escape + event key code + Firefox

Reported by: nanodeath Owned by: brandon
Priority: low Milestone:
Component: event Version: 1.3.2
Keywords: esc keypress which Cc:
Blocked by: Blocking:

I want to capture when the user hits "Esc" on a input text field on keypress, but this event gets propagated with the "which" value 0 on Firefox (0 is the charCode, 27 is the keyCode). keyup and keydown have their values propagated correctly.

Expected: pressing Esc should propagate 27 as value for event.which.

Actual: pressing Esc propagates 0 as value (in Firefox 3).

Note: this behavior is also present in jQuery 1.2.6.

Attachments (0)
Change History (5)

Changed May 11, 2009 10:39AM UTC by rmaclean comment:1

This appears to be a duplicate of #3311

Changed November 11, 2010 02:22PM UTC by boushley comment:2

This jsfiddle can be used to test what happens with keycodes.

Interestingly, IE 8 (didn't get a chance to test 6 or 7) properly show code 27, Firefox shows code 0, and Chrome/Safari don't register a keypress event for pressing escape.

Changed November 11, 2010 02:32PM UTC by SlexAxton comment:3

keywords: → esc keypress which
milestone: 1.41.5
priority: minorlow
status: newopen

Hmm, I wonder if there's a way to normalize this given that webkit doesn't seem to send anything at all. Appreciate the test case boushley. :)

Changed April 01, 2011 12:42AM UTC by dmethvin comment:4

resolution: → duplicate
status: openclosed

Changed April 01, 2011 12:43AM UTC by dmethvin comment:5

Duplicate of #7183.