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

UNCONFIRMED
Unassigned

Status

()

Core
DOM: Events
UNCONFIRMED
3 years ago
2 years ago

People

(Reporter: Clyde Vassallo, Unassigned)

Tracking

({testcase})

38 Branch
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

3 years ago
Created attachment 8627664 [details]
javascript-key-logger.html

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).

Updated

3 years ago
Component: Untriaged → DOM: Events
Keywords: testcase
Product: Firefox → Core

Comment 1

2 years ago
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.
You need to log in before you can comment on or make changes to this bug.