Closed Bug 1178759 Opened 9 years ago Closed 5 years ago

Keypress event when 'Enter' key is pressed has charCode set to 0

Categories

(Core :: DOM: Events, defect)

38 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1479964

People

(Reporter: cvassallo, Unassigned)

Details

(Keywords: testcase)

Attachments

(1 file)

Attached file javascript-key-logger.html (deleted) —
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36 Steps to reproduce: I have been monitoring keyboard events, namely: KeyDown KeyPress KeyUp The problem occurs when I press the 'Enter' key. Actual results: The actual result is: [KeyDown]: keyCode=13, which=13, charCode=0 () [KeyPress]: keyCode=13, which=13, charCode=0 () [KeyUp]: keyCode=13, which=13, charCode=0 () charCode field in KeyPress Event is set to 0 Expected results: The expected result is: [KeyDown]: keyCode=13, which=13, charCode=0 () [KeyPress]: keyCode=13, which=13, charCode=13 ( ) [KeyUp]: keyCode=13, which=13, charCode=0 () charCode field in KeyPress Event is set to 13 which is the Unicode value for carriage return (http://unicodelookup.com/#13/1).
Component: Untriaged → DOM: Events
Keywords: testcase
Product: Firefox → Core
I'm getting the same behavior as of the current date (18 Sept 2016), although the attachment is not working for me (can be tested at http://unixpapa.com/js/testkey.html to the same effect). Expected result listed would be consistent with Chrome behavior, but not with other characters in Firefox, which always give "0" as keyCode in keyPress events. Here is an alternate behavior that might be considered: [KeyDown]: keyCode=13, which=13, charCode=0 () [KeyPress]: keyCode=0, which=13, charCode=13 ( ) [KeyUp]: keyCode=13, which=13, charCode=0 () Compare with ";", which will give the exact same results with 59 instead of 13.
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: