UI Events KeyboardEvent code Implementation Report

Editor’s Draft,

More details about this document
This version:
https://w3c.github.io/uievents-code/impl-report.html
Issue Tracking:
GitHub
Editor:
(Google)

Abstract

This document reports on implementations of the [UIEvents-Code] specification.

Status of this document

This section describes the status of this document at the time of its publication. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.

This document was published by the Web Applications Working Group as an Editors Draft. This document is intended to become a W3C Recommendation.

This document was published by the Web Applications Working Group as a Working Draft. Feedback and comments on this specification are welcome. Please use GitHub issues Historical discussions can be found in the [email protected] archives.

Publication as an Editors Draft does not imply endorsement by W3C and its Members. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 2 November 2021 W3C Process Document.

1. Introduction

The [UIEvents-Code] specification defines the set of values that are valid for use in the code attribute.

This document summarizes the current implementation status of the code attribute and its values.

The following versions of each user agents were tested:

2. Methodology

Because there is no automated way to test these key press events (expecially considering that international keyboard are often required), these tests were all performed manually.

Manual tests were performed by visiting the domeeventviewer.com/key-event-viewer.html test page and examining the "code" column after pressing the key being tested. To test keys (like "IntlBackslash") that are only present on keyboards for certain locales, this requires using a keyboard that contains the key being tested.

For purposes of this report, Chrome, Firefox and Safari are considered independent implementations.

3. Results

3.1. Summary

Manual tests for all 112 required values of the code attribute Pass in at least 2 independent implementations.

The Candidate Recommendation exit criteria are therefore fulfilled.

In addition, the specification describes 60 optional values that may be used to support multimedia or legacy keyboards. Of these, manual tests confirm that 9 of these Pass in at least 2 independent implementations.

3.2. Raw Results

The following tables present the result of the manual tests.

Entries marked "Pass" generate the expected value when the corresponding key is pressed.

Entries marked "Fail" generate some value other than the expected value when the corresponding key is pressed. Wherever possible, a Note is included that provides more information about the failure.

Entries marked with a "?" have not been tested, typically because devices with that key were not available (for example, because keyboards with those keys are not supported on that platform).

Entries marked with "N/A" are not currently testable, typically because the devices with that key do not generate separate keyboard events. E.g., FnLock.

3.2.1. code Attribute

The code attribute (defined in [UIEvents]) is present in all browsers tested.

KeyboardEvent attribute Windows macOS Linux Notes
Chrome Firefox Edge Chrome Firefox Safari Chrome Firefox
code Pass Pass Pass Pass Pass Pass Pass Pass

3.2.2. Required code Values

This section lists the test results for the basic set of code attribute values that a conforming implementation must support.

code attribute value Windows macOS Linux Notes
Chrome Firefox Edge Chrome Firefox Safari Chrome Firefox
Alphanumeric Section - Writing System Keys
"Backquote" Pass Pass Pass Pass Pass Pass Pass Pass
"Backslash" Pass Pass Pass Pass Pass Pass Pass Pass
"BracketLeft" Pass Pass Pass Pass Pass Pass Pass Pass
"BracketRight" Pass Pass Pass Pass Pass Pass Pass Pass
"Comma" Pass Pass Pass Pass Pass Pass Pass Pass
"Digit0" Pass Pass Pass Pass Pass Pass Pass Pass
"Digit1" Pass Pass Pass Pass Pass Pass Pass Pass
"Digit2" Pass Pass Pass Pass Pass Pass Pass Pass
"Digit3" Pass Pass Pass Pass Pass Pass Pass Pass
"Digit4" Pass Pass Pass Pass Pass Pass Pass Pass
"Digit5" Pass Pass Pass Pass Pass Pass Pass Pass
"Digit6" Pass Pass Pass Pass Pass Pass Pass Pass
"Digit7" Pass Pass Pass Pass Pass Pass Pass Pass
"Digit8" Pass Pass Pass Pass Pass Pass Pass Pass
"Digit9" Pass Pass Pass Pass Pass Pass Pass Pass
"Equal" Pass Pass Pass Pass Pass Pass Pass Pass
"IntlBackslash" Pass Pass Pass Pass Pass Fail Pass Pass Safari swaps IntlBackslash with Backquote on keyboards that support IntlBackslash
"IntlRo" Pass Pass Pass ? ? ? ? ?
"IntlYen" Pass Pass Pass ? ? ? ? ?
"KeyA" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyB" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyC" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyD" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyE" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyF" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyG" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyH" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyI" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyJ" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyK" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyL" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyM" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyN" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyO" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyP" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyQ" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyR" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyS" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyT" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyU" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyV" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyW" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyX" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyY" Pass Pass Pass Pass Pass Pass Pass Pass
"KeyZ" Pass Pass Pass Pass Pass Pass Pass Pass
"Minus" Pass Pass Pass Pass Pass Pass Pass Pass
"Period" Pass Pass Pass Pass Pass Pass Pass Pass
"Quote" Pass Pass Pass Pass Pass Pass Pass Pass
"Semicolon" Pass Pass Pass Pass Pass Pass Pass Pass
"Slash" Pass Pass Pass Pass Pass Pass Pass Pass
Alphanumeric Section - Functional Keys
"AltLeft" Pass Pass Pass Pass Pass Pass Pass Pass
"AltRight" Pass Pass Pass Pass Pass Pass Pass Pass
"Backspace" Pass Pass Pass Pass Pass Pass Pass Pass
"CapsLock" Pass Pass Pass Pass Pass Pass Pass Pass
"ContextMenu" Pass Pass Pass Pass Pass Fail Pass Pass Safari returns "Unidentified"
"ControlLeft" Pass Pass Pass Pass Pass Pass Pass Pass
"ControlRight" Pass Pass Pass Pass Pass Pass Pass Pass
"Enter" Pass Pass Pass Pass Pass Pass Pass Pass
"MetaLeft" Pass Fail Pass Pass Fail Pass Pass Fail Firefox returns "OSLeft"
"MetaRight" Pass Fail Pass Pass Fail Pass Pass Fail Firefox returns "OSRight"
"ShiftLeft" Pass Pass Pass Pass Pass Pass Pass Pass
"ShiftRight" Pass Pass Pass Pass Pass Pass Pass Pass
"Space" Pass Pass Pass Pass Pass Pass Pass Pass
"Tab" Pass Pass Pass Pass Pass Pass Pass Pass
"Convert" Pass Pass Pass ? ? ? ? ?
"KanaMode" Pass Pass Pass ? ? ? ? ?
"NonConvert" Pass Pass Pass ? ? ? ? ?
Control Pad Section
"Delete" Pass Pass Pass Pass Pass Pass Pass Pass
"End" Pass Pass Pass Pass Pass Pass Pass Pass
"Home" Pass Pass Pass Pass Pass Pass Pass Pass
"Insert" Pass Pass Pass Pass Pass Fail Pass Pass Safari returns "Help"
"PageDown" Pass Pass Pass Pass Pass Pass Pass Pass
"PageUp" Pass Pass Pass Pass Pass Pass Pass Pass
Arrow Pad Section
"ArrowDown" Pass Pass Pass Pass Pass Pass Pass Pass
"ArrowLeft" Pass Pass Pass Pass Pass Pass Pass Pass
"ArrowRight" Pass Pass Pass Pass Pass Pass Pass Pass
"ArrowUp" Pass Pass Pass Pass Pass Pass Pass Pass
Numpad Section
"NumLock" Pass ? Pass Pass Pass Pass Pass Pass
"Numpad0" Pass ? Pass Pass Pass Pass Pass Pass
"Numpad1" Pass ? Pass Pass Pass Pass Pass Pass
"Numpad2" Pass ? Pass Pass Pass Pass Pass Pass
"Numpad3" Pass ? Pass Pass Pass Pass Pass Pass
"Numpad4" Pass ? Pass Pass Pass Pass Pass Pass
"Numpad5" Pass ? Pass Pass Pass Pass Pass Pass
"Numpad6" Pass ? Pass Pass Pass Pass Pass Pass
"Numpad7" Pass ? Pass Pass Pass Pass Pass Pass
"Numpad8" Pass ? Pass Pass Pass Pass Pass Pass
"Numpad9" Pass ? Pass Pass Pass Pass Pass Pass
"NumpadAdd" Pass ? Pass Pass Pass Pass Pass Pass
"NumpadDecimal" Pass ? Pass Pass Pass Pass Pass Pass
"NumpadDivide" Pass ? Pass Pass Pass Pass Pass Pass
"NumpadEnter" Pass ? Pass Pass Pass Pass Pass Pass
"NumpadMultiply" Pass ? Pass Pass Pass Pass Pass Pass
"NumpadSubtract" Pass ? Pass Pass Pass Pass Pass Pass
Function Section
"Escape" Pass Pass Pass Pass Pass Pass Pass Pass
"F1" Pass Pass Pass Pass Pass Pass Pass Pass
"F2" Pass Pass Pass Pass Pass Pass Pass Pass
"F3" Pass Pass Pass Pass Pass Pass Pass Pass
"F4" Pass Pass Pass Pass Pass Pass Pass Pass
"F5" Pass Pass Pass Pass Pass Pass Pass Pass
"F6" Pass Pass Pass Pass Pass Pass Pass Pass
"F7" Pass Pass Pass Pass Pass Pass Pass Pass
"F8" Pass Pass Pass Pass Pass Pass Pass Pass
"F9" Pass Pass Pass Pass Pass Pass Pass Pass
"F10" Pass Pass Pass Pass Pass Pass Pass Pass
"F11" Pass Pass Pass Pass ? ? Pass ? macOS & Ubuntu enter fullscreen; Chrome requires KeyboardLock
"F12" Pass Pass Pass Pass Pass Pass ? ?
"PrintScreen" Pass Pass Pass Fail Fail Fail ? ? macOS returns "F13"; Ubuntu takes screenshot
"ScrollLock" Pass Pass Pass ? ? ? Pass Pass macOS decreases brightness
"Pause" Pass Pass Pass ? ? ? Pass Pass macOS increases brightness
Special Values
"Unidentified" Pass Pass Pass Pass Pass Pass Pass Pass

3.2.3. Optional code Values

This section lists the test results for the set of code attribute values that a conforming implementation may use to support special keyboards (such as multimedia or legacy keyboards).

code attribute value Windows macOS Linux Notes
Chrome Firefox Edge Chrome Firefox Safari Chrome Firefox
Media Keys
"BrowserBack" Pass Pass Pass Fail Fail Fail Pass ? Handled by OS (Chrome requires KeyboardLock)
"BrowserFavorites" Pass Pass Pass Fail Fail Fail Pass ? Handled by OS (Chrome requires KeyboardLock)
"BrowserForward" Pass Pass Pass Fail Fail Fail Pass ? Handled by OS (Chrome requires KeyboardLock)
"BrowserHome" Pass ? Pass Fail Fail Fail Pass ? Handled by OS (Chrome requires KeyboardLock)
"BrowserRefresh" ? ? Fail ? ? ? ? ?
"BrowserSearch" Fail ? Fail Fail Fail Fail Fail Fail
"BrowserStop" ? ? ? ? ? ? ? ?
"Eject" ? ? ? ? ? ? ? ?
"LaunchApp1" ? ? ? Fail Fail Fail ? ?
"LaunchApp2" ? ? ? Fail Fail Fail ? ?
"LaunchMail" N/A N/A N/A N/A N/A N/A N/A N/A Handled by OS
"MediaPlayPause" N/A N/A N/A N/A N/A N/A N/A N/A Handled by OS
"MediaSelect" ? ? ? ? ? ? ? ?
"MediaStop" ? ? ? ? ? ? ? ?
"MediaTrackNext" ? ? ? ? ? ? ? ?
"MediaTrackPrevious" ? ? ? ? ? ? ? ?
"Power" ? ? ? Fail ? ? ? ?
"Sleep" ? ? ? Fail ? ? ? ?
"AudioVolumeDown" N/A N/A N/A N/A N/A N/A N/A N/A Handled by OS
"AudioVolumeMute" N/A N/A N/A N/A N/A N/A N/A N/A Handled by OS
"AudioVolumeUp" N/A N/A N/A N/A N/A N/A N/A N/A Handled by OS
"WakeUp" ? ? ? Fail ? ? ? ?
Alphanumeric Section - Functional Keys
"Lang1" ? ? ? Fail Pass Fail Pass Pass Safari returns KanaMode
"Lang2" ? ? ? Fail Pass Pass Pass Pass
"Lang3" ? ? ? ? ? ? ? ?
"Lang4" ? ? ? ? ? ? ? ?
"Lang5" ? ? ? ? ? ? ? ?
Numpad Section
"NumpadBackspace" Fail Fail Fail Fail ? ? Fail Fail Chrome/Firefox/Safari return "Backspace"
"NumpadClear" ? ? ? ? ? ? ? ?
"NumpadClearEntry" ? ? ? ? ? ? ? ?
"NumpadComma" ? ? ? ? ? ? ? ? Need to test with Brazilian keyboard.
"NumpadEqual" Pass ? Pass Pass ? ? Pass Pass
"NumpadHash" ? ? ? ? ? ? ? ?
"NumpadMemoryAdd" ? ? ? ? ? ? ? ?
"NumpadMemoryClear" ? ? ? ? ? ? ? ?
"NumpadMemoryRecall" ? ? ? ? ? ? ? ?
"NumpadMemoryStore" ? ? ? ? ? ? ? ?
"NumpadMemorySubtract" ? ? ? ? ? ? ? ?
"NumpadParenLeft" Pass ? ? Fail ? ? Pass Pass
"NumpadParenRight" Pass ? ? Fail ? ? Pass Pass
"NumpadStar" ? ? ? ? ? ? ? ?
Function Section
"Fn" N/A N/A N/A N/A N/A N/A N/A N/A
"FnLock" N/A N/A N/A N/A N/A N/A N/A N/A
Legacy, Non-Standard and Special Keys
"Hyper" ? ? ? ? ? ? ? ?
"Super" ? ? ? ? ? ? ? ?
"Turbo" ? ? ? ? ? ? ? ?
"Abort" ? ? ? ? ? ? ? ?
"Resume" ? ? ? ? ? ? ? ?
"Suspend" ? ? ? ? ? ? ? ?
"Again" ? ? ? ? ? ? ? ?
"Copy" ? ? ? ? ? ? ? ?
"Cut" ? ? ? ? ? ? ? ?
"Find" ? ? ? ? ? ? ? ?
"Open" ? ? ? ? ? ? ? ?
"Paste" ? ? ? ? ? ? ? ?
"Props" ? ? ? ? ? ? ? ?
"Select" ? ? ? ? ? ? ? ?
"Undo" ? ? ? ? ? ? ? ?
"Hiragana" ? ? ? ? ? ? ? ?
"Katakana" ? ? ? ? ? ? ? ?

Conformance

Document conventions

Conformance requirements are expressed with a combination of descriptive assertions and RFC 2119 terminology. The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in RFC 2119. However, for readability, these words do not appear in all uppercase letters in this specification.

All of the text of this specification is normative except sections explicitly marked as non-normative, examples, and notes. [RFC2119]

Examples in this specification are introduced with the words “for example” or are set apart from the normative text with class="example", like this:

This is an example of an informative example.

Informative notes begin with the word “Note” and are set apart from the normative text with class="note", like this:

Note, this is an informative note.

Conformant Algorithms

Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or "return false and abort these steps") are to be interpreted with the meaning of the key word ("must", "should", "may", etc) used in introducing the algorithm.

Conformance requirements phrased as algorithms or specific steps can be implemented in any manner, so long as the end result is equivalent. In particular, the algorithms defined in this specification are intended to be easy to understand and are not intended to be performant. Implementers are encouraged to optimize.

Index

Terms defined by reference

References

Normative References

[RFC2119]
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://datatracker.ietf.org/doc/html/rfc2119
[UIEvents]
Gary Kacmarcik; Travis Leithead. UI Events. URL: https://w3c.github.io/uievents/
[UIEvents-Code]
Gary Kacmarcik; Travis Leithead. UI Events KeyboardEvent code Values. URL: https://w3c.github.io/uievents-code/