Closed Bug 112379 Opened 24 years ago Closed 24 years ago

keyCode always zero (0) for keypress events

Categories

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

x86
All
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: bugzilla, Assigned: joki)

References

Details

Attachments

(2 files)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.6+) Gecko/20011125 BuildID: 20011125 keyCode always return 0. which returns the correct value. But shouldn't keyCode return the same as which? Reproducible: Always Steps to Reproduce: 1. run testcase
One other bad thing, is that when you press the button the document has not the focus, the urlbar has it. After clicking on the document it works. But then you notice that if you press the spacebar the alert button shows for a milisecond and then it disappears!
Build ID: 2001 11 27 03. Windows 2000. When trying the testcase, not every key results in keyCode 0. For example, RETURN causes 13, and ESCAPE 27.
Yes, also the arrow keys return a value, but not all the keyboard. About pressing space and the disappearing alert, maybe I should file a new bug on that?
Summary: Event.keyCode always return 0 → Event.keyCode does not always return correct value
Status: UNCONFIRMED → NEW
Ever confirmed: true
Event.which is an old property from Netscape 4.x. Mozilla uses event.keyCode and event.charCode. These values are set differently depending on the event although the general rule is that keypresses which generate characters use charCode and keypresses which do not use keyCode. Event.which is set to whichever value most closely matches the old values returned by 4.x and is not expected to match keyCode or charCode 100% of the time.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → INVALID
QA Contact: madhur → rakeshmishra
*** Bug 140846 has been marked as a duplicate of this bug. ***
QA Contact: rakeshmishra → trix
*** Bug 318735 has been marked as a duplicate of this bug. ***
Summary: Event.keyCode does not always return correct value → keyCode always zero (0) for keypress events
I see no reason why this bug was abandoned in 2001, I've just come across this issue and as far as I can tell the keydown event has not been deprecated (unable to find any reference to a list of events in DOM4).
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: