Closed Bug 372015 Opened 13 years ago Closed 13 years ago

No KeyPress event fires for Up/Down Arrow and Page Up/Down keys


(Core :: DOM: UI Events & Focus Handling, defect)

1.8 Branch
Not set





(Reporter: bugs-a17, Assigned: mano)


(Blocks 1 open bug)


(Keywords: regression, testcase, verified1.8.1.4)


(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20070220 Firefox/
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20070220 Firefox/

In FireFox, the four keys: Up Arrow, Down Arrow, Page Up and Page Down will generate KeyDown events but not KeyPress events.  All other keys work normally.

This has been tested on both the Linux and Windows builds.  This bug was not present in FF or previous versions.

Reproducible: Always

Steps to Reproduce:
1. Create a little test script that contains an <INPUT type="text"> element and handlers for KeyDown and KeyPress that tell you when they fire (e.g., see below).
2. Focus the input field and press various keys; note that for each key pressed, both events fire.
3.  Now press UpArrow, DownArrow, PageUp or PageDown.
Actual Results:  
Only the onKeyDown event fires for UpArrow, DownArrow, PageUp and PageDown.

Expected Results:  
The onKeyPress event should fire for these four keys.

Here's a silly little test page as described above:

<html><head><script type="text/javascript">
press = down = 0;
<input type="text" name="test"
 onkeypress="document.getElementById('press').innerHTML='KeyPress events = '+(++press);"
 onkeydown="document.getElementById('down').innerHTML='KeyDown events = '+(++down);" >
<p id="press"></p>
<p id="down"></p>
Assignee: nobody → events
Component: General → Event Handling
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → 1.8 Branch
Huh, what could have caused this regression.
Reporter, could you upload the testcase using "Add an attachment".
Ok, I think this is related to autocomplete.
When autocomplete="off", keypress is dispatched.
Ever confirmed: true
OK, per request of Smaug, a slightly more elegant test script is attached which accomplishes the same task as the silly example inlined above.

Focus the input field and then type.  Up/Down arrows won't update the KeyPress listing.
Maybe bug 286933? 
Flags: blocking1.8.1.4?
Assignee: events → mano
Flags: blocking1.8.1.4? → blocking1.8.1.4+
Keywords: regression
Blocks: 286933
fixed by backing it out.
Closed: 13 years ago
Keywords: fixed1.8.1.4
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.8.1
Verified fixed using testcase from comment #3 with 

Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv: Gecko/2007042403 BonEcho/

Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/2007042603 BonEcho/ on Fedora FC6 

and Verified Fixed on Trunk on Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/2007042603 BonEcho/ Windows Vista

The Testcase shows the expected results, the KeyPress event fires -> adding verified flags
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.