Ticket #4556 (closed bug: duplicate)
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: | |
| Blocking: | Blocked by: |
Description
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.
Change History
comment:3 Changed 3 years ago by boushley
This jsfiddle can be used to test what happens with keycodes. http://jsfiddle.net/boushley/YxunV/1/
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.
comment:4 Changed 3 years ago by SlexAxton
- Keywords esc keypress which added
- Priority changed from minor to low
- Status changed from new to open
- Milestone changed from 1.4 to 1.5
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. :)
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

This appears to be a duplicate of #3311