Open Bug 574673 Opened 13 years ago Updated 6 months ago

Holding down key on Mac fires different events from other platforms/browsers


(Firefox :: General, defect)

3.6 Branch





(Reporter: spamstephenmorley, Unassigned)


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-GB; rv: Gecko/20100611 Firefox/3.6.4 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20100527 Firefox/3.6.4

Firefox 3.6 on a Mac differs from all other browsers I tested (Firefox 3.6 on a PC, Chrome 5 on Mac and PC, Safari 4 on Mac and PC, and Internet Explorer 8) in the events it fires when holding down keys such as the delete key.

While the other browsers fire the keydown event repeatedly, Firefox for Mac files the keypress event repeatedly. Firefox for PC fires both events repeatedly, but this is easy to handle as the keypress event can be suppressed in the handler for the keydown event.

This is particularly problematic for the delete key, as code using the standard (e.charCode || e.keyCode) trick to determine ASCII codes in a keydown event handler mistakes the delete key events for the period key (the delete key has a key code of 46, while the period key has a charCode of 46).

Reproducible: Always

Steps to Reproduce:
1. Go to and scroll to the testing form at the bottom
2. Check the four boxes
3. Hold down the delete key
Actual Results:  
The following event is displayed repeatedly:

keyCode is 46
charCode is 0

Expected Results:  
The following event should be displayed repeatedly:

keyCode is 46
charCode is 0
A correction: in the third paragraph "determine ASCII codes in a keydown event
handler" should be "determine ASCII codes in a keypress event
When I run the test case using Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.3a6pre) Gecko/20100625 Minefield/3.7a6pre, I get a keydown event followed by successive keypress events. So are you saying if you are holding it they should be all keydown events?
Marcia: Yes. That's what Firefox on a PC, Chrome, Safari, and Internet Explorer all do. Behaving like the other browsers would prevent Mac Firefox users from falling victims to bugs in JavaScript code written by programmers not aware of this difference.
Version: unspecified → 3.6 Branch
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.