Bug 156446

Summary: keyCode and charCode properties should live in KeyboardEvent, not UIEvent
Product: WebKit Reporter: Chris Rebert <webkit>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: rbuis, sam, simon.fraser
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Mac   
OS: OS X 10.11   

Chris Rebert
Reported 2016-04-09 15:12:27 PDT
The following evaluates to true in WebKit Nightly, and to false in Chrome, Firefox, and Edge: 'keyCode' in UIEvent.prototype && 'charCode' in UIEvent.prototype Per the UI Events spec, keyCode and charCode should be properties of KeyboardEvent, not of UIEvent. See: * https://w3c.github.io/uievents/#interface-uievent * https://w3c.github.io/uievents/#legacy-interface-KeyboardEvent
Attachments
Simon Fraser (smfr)
Comment 1 2016-04-09 16:04:22 PDT
keyCode and charCode were present on UIEvent from long ago in the codebase. KeyboardEvent has them in the IDL, but hidden from JavaScript, oddly. Neither match the spec[1], which has: readonly attribute DOMString key; readonly attribute DOMString code; [1] https://w3c.github.io/uievents/#events-keyboardevents
Chris Rebert
Comment 2 2016-04-09 16:31:21 PDT
To clarify, I'm referring to the legacy[1] KeyboardEvent.keyCode and KeyboardEvent.charCode properties: partial interface KeyboardEvent { // The following support legacy user agents readonly attribute unsigned long charCode; readonly attribute unsigned long keyCode; which are distinct from the modern[2] KeyboardEvent.key and KeyboardEvent.code properties. [1]: https://w3c.github.io/uievents/#legacy-interface-KeyboardEvent [2]: https://w3c.github.io/uievents/#events-keyboardevents
Lucas Forschler
Comment 3 2019-02-06 09:18:36 PST
Mass move bugs into the DOM component.
Rob Buis
Comment 4 2020-08-22 05:45:18 PDT
This was fixed by r209895.
Note You need to log in before you can comment on or make changes to this bug.