Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#7300 closed bug (wontfix)

Keypress not getting arrow keys in chrome

Reported by: [email protected] Owned by:
Priority: high Milestone: 1.5
Component: event Version: 1.4.3
Keywords: keypress arrow-keys chrome Cc: john
Blocked by: Blocking:


The keypress event is triggered by the arrow keys in Firefox, but not in chrome.

OS: Mac 10.5.8

Browser: Chrome 7.0.517.41

The problem can be seen on the example page (http://api.jquery.com/keydown/) in chrome when compared to Firefox

I would expect that the arrow key would trigger the event as that is what happens in Safari.

Change History (5)

comment:1 Changed 12 years ago by addyosmani

Keywords: keypress arrow-keys chrome needsreview added
Priority: undecidedhigh
Status: newopen

I have just tested the keydown API page in FireFox, Chrome and Safari (all on the latest stable builds) and the arrow keys are being captured correctly/fine in all of these browsers - I believe you meant to refer to the /keypress page instead.

Testing keypress, I see that there is definitely some issue with Chrome correctly capturing the right, left, up and down keys, but not an issue with it doing so using any other key (as far as I can tell). To ensure this isn't an issue with our API page i setup a test here http://jsfiddle.net/addyosmani/nmNjV/. I have also verified this issue offline and it appears to be consistently failing with arrow keys and keypress.

Marking as valid and flagging for further review.

comment:2 Changed 12 years ago by addyosmani

Cc: john added
Component: unfiledevent

dmethvin has also confirmed this issue. I'll also add that I'm experiencing it in Safari 5.02 so it may be a generic Webkit problem. We've tested capturing keypress without jQuery in those browsers and are experiencing issues there too so a (slightly) larger workaround of some sort may be needed.

Just for further confirmation: this is broken with 1.4.3, 1.4.2 and 1.3.2 as well (all testing has been done on OSX so far for what it's worth).

Last edited 12 years ago by addyosmani (previous) (diff)

comment:3 Changed 12 years ago by addyosmani

Resolution: wontfix
Status: openclosed

I've reviewed the bulk of tickets regarding keypress on both the Chrome, Chromium and Webkit bug trackers and it would appear that there are no intentions on supporting correct keypress behavior from any of these camps now or in the future. The reason for this is that a) keypress and its behavior is not mentioned specifically in any specs and b) Although FireFox and Opera support this feature, Webkit (used by Chrome and Safari) decided to copy the IE behavior in this case which reserves arrow keypresses for internal browser behavior only. There is no way that jQuery can circumvent this behavior and it is instead recommended that you use keydown instead as this is supported.

comment:4 Changed 12 years ago by dmethvin

Keywords: needsreview removed

comment:5 in reply to:  4 Changed 12 years ago by [email protected]

Replying to dmethvin:

This is a real pain as the Backspace key is not recognised either.

Note: See TracTickets for help on using tickets.