UI Events KeyboardEvent code Values

W3C Working Draft,

This version:
https://www.w3.org/TR/2018/WD-uievents-code-20180411/
Latest published version:
http://www.w3.org/TR/uievents-code/
Editor's Draft:
https://w3c.github.io/uievents-code/
Previous Versions:
Issue Tracking:
GitHub
Editors:
(Google)
(Microsoft)

Abstract

This specification defines the values for the KeyboardEvent.code attribute, which is defined as part of the UI Events Specification [UIEvents]. The code value contains information about the key event that can be used to identify the physical key being pressed by the user.

Status of this document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. 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 Platform Working Group as a Working Draft. This document is intended to become a W3C Recommendation.

Feedback and comments on this specification are welcome, please send them to public-webapps@w3.org (subscribe, archives) with [uievents-code] at the start of your email’s subject.

Publication as a Working Draft does not imply endorsement by the W3C Membership. 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 1 February 2018 W3C Process Document.

1. Introduction

This document provides an overview of the various keyboard layouts and specifies the code values that should be used for each of the keys. Unlike the key values described in [UIEvents-key], the code values are based only on the key’s physical location on the keyboard and do not vary based on the user’s current locale.

This specification was formerly titled DOM Level 3 KeyboardEvent code Values.

1.1. Stylistic Conventions

This specification uses the following conventions:

2. Keyboard Layout

This section is non-normative.

Alphanumeric keyboards are the most common way for users to generate keyboard events. This section provides an overview of standard keyboards and their physical layouts.

2.1. Standard Keyboard Layouts

This section describes the physical layouts found on commonly available keyboards.

2.1.1. Keyboard Sections

When discussing keyboard layouts, it is convenient to divide the standard keyboard into distinct sections and to label each row.

The five general sections of a standard keyboard
The five general sections of a standard keyboard

These keyboard sections are:

To make it easier to identify keys, the rows on the keyboard are named starting with "A" for the bottom row up to "E" for the top row. The row of keys in the function section are considered to be in row "K". These row names are consistent with those given in [ISO9995-1].

Note that many keyboards (both modern and legacy) have extra keys that do not fit neatly into the above sections. Some of these keys are covered in §3.1.6 Media Keys.

2.1.2. Standard "101" Keyboard Layout

The standard "101" keyboard (commonly referred to as the "US layout") is the only layout that has a "Backslash" key (labeled \|) above a single-row Enter key. All the other layouts omit this key and expand the Enter key to occupy two-rows.

Standard '101' keyboard layout
Standard "101" keyboard layout showing unmodified US key values

Modern standard "101"-layout keyboards actually contain 104 keys: 61 keys in the alphanumeric section and 43 keys in the numpad, control pad, arrow pad and function sections. The "101" name for this keyboard layout dates to the time when this standard keyboard did in fact contain 101 keys. The two Meta keys (commonly given an OS-specific label), and the Menu key were added later to bring the total to 104 keys.

2.1.3. Alternate "101" Keyboard Layout

The alternate "101" keyboard has a large Enter key and shrinks the Backspace key to make room for the "IntlYen" key (which replaces the "Backslash" key found in the standard 101 layout). The "IntlYen" name comes from the Japanese layout where this is the ¥ (yen) key — in the Russian layout shown below this key maps to a \/.

Alternate '101' keyboard layout
Alternate "101" keyboard layout showing unmodified Russian key values

Modern alternate "101"-layout keyboards contain 104 keys: 61 keys in the alphanumeric section and 43 keys in the numpad, control pad, arrow pad and function sections.

2.1.4. Standard "102" Keyboard Layout

The standard "102" keyboard is common throughout Europe and adds a key that doesn’t exist on the "101" layouts: The "IntlBackslash" key (labelled \| on a UK keyboard) next to the left shift key.

A second key is also added (labelled #~ on a UK keyboard) which is partially tucked under the Enter key. This key is encoded as "Backslash", using the same code as the \| key found on the "101" keyboard layout. According to [USB-HID], the US \| and UK #~ are actually two separate keys (named "Keyboard \ and |" and "Keyboard Non-US # and ~"), but since these two keys never co-occur on the same keyboard most platforms use the same scancode for both keys, making them difficult to distinguish. It is for this reason that the code "Backslash" is used for both of these keys.

Standard '102' keyboard layout
Standard "102" keyboard layout showing unmodified UK key values

Modern "102"-layout keyboards contain 105 keys: 62 keys in the alphanumeric section and 43 keys in the numpad, control pad, arrow pad and function sections.

2.1.5. Korean "103" Keyboard Layout

The Korean "103" keyboard is based on the alternate 101 layout and adds two additional keys (one on each side of the spacebar) to handle Korean-specific input modes. These keys are "Lang2" ("Hanja", labelled 한자 hanja) and "Lang1" ("HangulMode", labelled 한/영 han/yeong).

Korean '103' keyboard layout
Korean "103" keyboard layout showing unmodified Korean key values

Modern "103"-layout keyboards contain 106 keys: 63 keys in the alphanumeric section and 43 keys in the numpad, control pad, arrow pad and function sections.

2.1.6. Brazilian "104" Keyboard Layout

The "104" layout used in Brazil adds 4 new keys: two keys from the "102" layout ("Backslash" and "IntlBackslash") plus the "IntlRo" key (next to the right shift key) and an extra key on the numpad. This new numpad key is called "NumpadComma" because it represents the thousands separator. On the Brazilian key layout, this key is labelled . and the "NumpadDecimal" key is labelled ,.

Standard '104' keyboard layout
Standard "104" keyboard layout showing unmodified Brazilian key values

Modern "104"-layout keyboards contain 107 keys: 63 keys in the alphanumeric section and 44 keys in the numpad, control pad, arrow pad and function sections. Some Brazilian keyboards lack the extra numpad key and have only 106 keys.

2.1.7. Japanese "106" Keyboard Layout

The Japanese "106" keyboard layout adds 3 new keys: "IntlYen" (labelled ¥_), "Backslash" (labelled ]む) and "IntlRo" (labelled \ろ). It also shrinks the spacebar to make room for 3 input mode keys: "NonConvert" (labelled 無変換 muhenkan), "Convert" (labelled 変換 henkan) and "KanaMode" (labelled カタカナ/ひらがな/ローマ字 katakana/hiragana/romaji).

Standard '106' keyboard layout
Standard "106" keyboard layout showing unmodified Japanese key values

Modern "106"-layout keyboards contain 109 keys: 66 keys in the alphanumeric section and 43 keys in the numpad, control pad, arrow pad and function sections.

2.1.8. Apple Keyboard Layout

In general, Apple keyboards follow the same layout as PC keyboards, but there are some differences as noted in the following figure.

Apple extended keyboard layout
Apple extended keyboard layout showing unmodified English key values

In this figure, the green keys are those that have been moved to a new location while the blue keys indicate keys that have been added.

2.1.9. Laptop Keyboard Layouts

The limited space available on laptop keyboards often means that the physical key layout needs to be adjusted to fit all the required keys. The writing system keys in the alphanumeric section tend to remain intact, but the other keyboard sections are usually combined with other keys or removed altogether.

Apple laptop keyboard layout
Apple laptop keyboard layout

In this Apple laptop keyboard, the right control key has been removed to make room for half-height arrow keys and a Fn key is added on the left.

Sample PC laptop keyboard layout
Sample PC laptop keyboard layout

PC laptop keyboards vary considerably, but this sample keyboard demonstrates some commonly found aspects. The control pad keys are added along the right-hand side with the arrow pad keys tucked in along the bottom. The right Shift key is often shrunk to make room for the up arrow key and the right Meta key is typically removed altogether.

2.1.10. Keyboard Layouts For Other Locales

Other locales are not explicitly described in this specification because they start with one of the existing layouts and adapt it by changing the keycaps and the key mappings.

Because these keyboards do not introduce new physical keys, they do not require explicit documentation.

These keyboards are typically based on the "101" (standard or alternate) or "102" layouts. For example, the common Arabic, Cyrillic, Greek, Hindi, Khmer and Thai keyboards are all based on either the "101" or "102" keyboard layouts.

2.2. Mobile Keypads

In the case where a content author wishes to rely on the mechanical layout of a mobile keypad, this specification suggests the keyboard configuration specified in [ISO9995-8], which defines a numeric keypad layout and secondary assignment of Unicode characters in the range U+0061 ... U+007A ("a" - "z") to the number keys 2 through 9, as a common layout appropriate to some international uses.

This keypad layout, and in particular the distribution of letters is for English devices, and will not match the keypads or configurations of many users. Content authors cannot rely upon any particular configuration, and are expected to create content in an internationalized and localizable manner.

Mobile keypad layout
A graphical depiction of a generic mobile keypad.

2.3. Media Remote Controls

Many keyboards contain special keys to control media functions. Increasingly, many media devices, especially televisions, are Web-enabled. Hybrid keyboard/remote-control devices are becoming more common. To meet the needs of these hybrid Web/media devices, this specification defines keys that are common as remote control buttons, in addition to traditional keyboard keys.

Because of the smaller form factor, keys (or buttons) on a remote control will often be modal, with one key performing different functions based on the context of the on-screen content. Additionally, many keys serve as toggles, to change back and forth between two or more states (see toggling keys). These remote control buttons typically do not have modifier states so each button is assigned a single function (like Play, Pause, Up, Menu or Exit).

A sample media remote control
A graphical depiction of a media remote control.

2.4. Virtual Keyboards and Chording Keyboards

Virtual keyboards are software-based sets of keys, in a variety of different arrangements, commonly found on touch-screen devices. They are often modal, with the ability to switch between different dynamic sets of keys, such as alphabetic, numeric, or symbolic keys. Because of the lack of physical constraints, these keyboards MAY present the widest range of characters, including emoticons and other symbols. Wherever possible, however, virtual keyboards SHOULD produce the normal range of keyboard events and values, for ease of authoring and compatibility with existing content.

Chording keyboards, also known as chorded keysets or chord keyboards, are key input devices which produce values by pressing several keys in combination or sequence, normally to simulate a full range of characters or commands on a reduced set of keys, often for single-handed use. A chording keyboard MAY have additional mode keys to switch between key values, and the number and type of keys pressed to produce a key value will vary, but the final key values produced by such keyboards SHOULD match the range of key values described in this specification.

For these and other alternative modal keyboards, the key values "Alphanumeric", "CapsLock", "NumLock", and "SymbolLock" are RECOMMENDED for the keys which switch between different modes.

3. Keyboard Event code Value Tables

This section defines a list of code values which implementations MUST support.

A conforming implementation of the KeyboardEvent interface MUST support this set of values for use in the code attributes, although not all values MAY be available on all platforms or devices.

A key code attribute value is any of the values given in the "KeyboardEvent.code" column of any of the tables in this section of the specification.

Future versions of this specification MAY include code values not included here, which have become common since the publication of this specification.

Note: While every attempt has been made to make this list of values as complete as possible, new values will periodically need to be defined as new input devices are introduced. Rather than allowing user agents to define their own key code attribute values (which are unlikely to be consistent across multiple user agents), bugs SHOULD be filed so that this specification can be updated.

3.1. Key Codes for Standard Keyboards

This section describes the various keyboard sections in more detail and defines the code values that should be used for each key.

3.1.1. Alphanumeric Section

The alphanumeric section is the main section of the keyboard. It contains keys that fall into two general categories: writing system keys whose meaning changes based on the current keyboard layout, and functional keys which are (mostly) the same for all layouts.

3.1.1.1. Writing System Keys

The writing system keys are those that change meaning (i.e., they produce different key values) based on the current locale and keyboard layout.

The writing system keys
The writing system keys in the alphanumeric section

This figure shows a hypothetical keyboard that combines all the writing system keys (shown in blue and green) found on the various keyboards. Blue keys are present on all standard keyboards while green keys are only available on some keyboards.

The "Digit2" and "KeyQ" keys are writing system keys that generate "2" and "q" when the US locale is active and "é" and "a" when the French locale is active.

The name shown on each key is the code assigned to that key. Wherever possible, the code names are based on the name for the US key in that position (i.e., they are based on the US keyboard layout). For keys that don’t exist on the US keyboard, names from the UK or Japanese layouts are used instead.

Note that there are two "Backslash" keys in this figure: a large one at the end of Row D on the 101-key layout, and a smaller one between "Quote" and "Enter" on Row C of the 102-, 104- and 106-key layouts. Only one "Backslash" key may be present on a keyboard layout.

List of code values for writing system keys in the Alphanumeric section.
KeyboardEvent code Notes (Non-normative)
"Backquote" `~ on a US keyboard. This is the 半角/全角/漢字 (hankaku/zenkaku/kanji) key on Japanese keyboards
"Backslash" Used for both the US \| (on the 101-key layout) and also for the key located between the " and Enter keys on row C of the 102-, 104- and 106-key layouts. Labelled #~ on a UK (102) keyboard.
"BracketLeft" [{ on a US keyboard.
"BracketRight" ]} on a US keyboard.
"Comma" ,< on a US keyboard.
"Digit0" 0) on a US keyboard.
"Digit1" 1! on a US keyboard.
"Digit2" 2@ on a US keyboard.
"Digit3" 3# on a US keyboard.
"Digit4" 4$ on a US keyboard.
"Digit5" 5% on a US keyboard.
"Digit6" 6^ on a US keyboard.
"Digit7" 7& on a US keyboard.
"Digit8" 8* on a US keyboard.
"Digit9" 9( on a US keyboard.
"Equal" =+ on a US keyboard.
"IntlBackslash" Located between the left Shift and Z keys. Labelled \| on a UK keyboard.
"IntlRo" Located between the / and right Shift keys. Labelled \ろ (ro) on a Japanese keyboard.
"IntlYen" Located between the = and Backspace keys. Labelled ¥ (yen) on a Japanese keyboard. \/ on a Russian keyboard.
"KeyA" a on a US keyboard. Labelled q on an AZERTY (e.g., French) keyboard.
"KeyB" b on a US keyboard.
"KeyC" c on a US keyboard.
"KeyD" d on a US keyboard.
"KeyE" e on a US keyboard.
"KeyF" f on a US keyboard.
"KeyG" g on a US keyboard.
"KeyH" h on a US keyboard.
"KeyI" i on a US keyboard.
"KeyJ" j on a US keyboard.
"KeyK" k on a US keyboard.
"KeyL" l on a US keyboard.
"KeyM" m on a US keyboard.
"KeyN" n on a US keyboard.
"KeyO" o on a US keyboard.
"KeyP" p on a US keyboard.
"KeyQ" q on a US keyboard. Labelled a on an AZERTY (e.g., French) keyboard.
"KeyR" r on a US keyboard.
"KeyS" s on a US keyboard.
"KeyT" t on a US keyboard.
"KeyU" u on a US keyboard.
"KeyV" v on a US keyboard.
"KeyW" w on a US keyboard. Labelled z on an AZERTY (e.g., French) keyboard.
"KeyX" x on a US keyboard.
"KeyY" y on a US keyboard. Labelled z on a QWERTZ (e.g., German) keyboard.
"KeyZ" z on a US keyboard. Labelled w on an AZERTY (e.g., French) keyboard, and y on a QWERTZ (e.g., German) keyboard.
"Minus" -_ on a US keyboard.
"Period" .> on a US keyboard.
"Quote" '" on a US keyboard.
"Semicolon" ;: on a US keyboard.
"Slash" /? on a US keyboard.
3.1.1.2. Functional Keys

The functional keys (not to be confused with the function keys described later) are those keys in the alphanumeric section that provide general editing functions that are common to all locales (like Shift, Tab, Enter and Backspace). With a few exceptions, these keys do not change meaning based on the current keyboard layout.

The standard set of functional keys
The standard set of functional keys in the alphanumeric section

The "AltRight" key (highlighted in green) is the only functional key that does not generate the same key value for every locale. In some locales it produces "Alt" while in others it produces "AltGraph".

List of code values for functional keys in the Alphanumeric section.
KeyboardEvent code Notes (Non-normative)
"AltLeft" Alt, Option or .
"AltRight" Alt, Option or . This is labelled AltGr key on many keyboard layouts.
"Backspace" Backspace or . Labelled Delete on Apple keyboards.
"CapsLock" CapsLock or
"ContextMenu" The application context menu key, which is typically found between the right Meta key and the right Control key.
"ControlLeft" Control or
"ControlRight" Control or
"Enter" Enter or . Labelled Return on Apple keyboards.
"MetaLeft" The Windows, , Command or other OS symbol key.
"MetaRight" The Windows, , Command or other OS symbol key.
"ShiftLeft" Shift or
"ShiftRight" Shift or
"Space"   (space)
"Tab" Tab or

On some keyboards (notably Japanese and Korean) the spacebar is reduced in size to make room for extra keys on the bottom row (Row A). These keys typically allow the users to change the current input mode. Note that even though some of these Japanese and Korean keys occupy the same physical location on the keyboard, they use different code values.

Comparison of the lower row of functional keys
Comparison of the lower row of functional keys on different keyboards
List of code values for functional keys found on Japanese and Korean keyboards.
KeyboardEvent code Notes (Non-normative)
"Convert" Japanese: 変換 (henkan)
"KanaMode" Japanese: カタカナ/ひらがな/ローマ字 (katakana/hiragana/romaji)
"Lang1" Korean: HangulMode 한/영 (han/yeong)
Japanese (Mac keyboard): かな (kana)
"Lang2" Korean: Hanja 한자 (hanja)
Japanese (Mac keyboard): 英数 (eisu)
"Lang3" Japanese (word-processing keyboard): Katakana
"Lang4" Japanese (word-processing keyboard): Hiragana
"Lang5" Japanese (word-processing keyboard): Zenkaku/Hankaku
"NonConvert" Japanese: 無変換 (muhenkan)

On Apple keyboards, some keys on the bottom row are omitted and others are arranged in a different order.

3.1.2. Control Pad Section

The control pad section of the keyboard is the set of (usually 6) keys that perform navigating and editing operations, for example, Home, PageUp and Insert.

Standard Control Pad layouts
Standard control pad layouts
List of code values for keys in the ControlPad section.
KeyboardEvent code Notes (Non-normative)
"Delete" . The forward delete key. Note that on Apple keyboards, the key labelled Delete on the main part of the keyboard should be encoded as "Backspace".
"End" Page Down, End or
"Help" Help. Not present on standard PC keyboards.
"Home" Home or
"Insert" Insert or Ins. Not present on Apple keyboards.
"PageDown" Page Down, PgDn or
"PageUp" Page Up, PgUp or

The code for the Fn key (found on some Apple keyboards) is defined below in the function section.

3.1.3. Arrow Pad Section

The arrow pad contains the 4 arrow keys. The keys are commonly arranged in an "upside-down T" configuration.

Standard Arrow Pad layout
Standard arrow pad layout
List of code values for keys in the ArrowPad section.
KeyboardEvent code Notes (Non-normative)
"ArrowDown"
"ArrowLeft"
"ArrowRight"
"ArrowUp"

3.1.4. Numpad Section

The numpad section is the set of keys on the keyboard arranged in a grid like a calculator or mobile phone. This section contains numeric and mathematical operator keys. Often this section will contain a NumLock key which causes the keys to switch between the standard numeric functions and mimicking the keys of the control pad and arrow pad. Laptop computers and compact keyboards will commonly omit these keys to save space.

A keypad is an alternate term for numpad.

Standard Numpad layouts
Standard numpad Layouts

The code values in this section should also be used for phone keypads and remote control devices that arrange number keys in a grid.

Standard mobile keypad layout
Standard Mobile Keypad Layout

The standard numpad is sometimes extended with additional keys for parentheses, operators, hexadecimal symbols, or calculator functions (like Backspace). Some of the commonly added keys are listed in the table below.

List of code values for keys in the Numpad section.
KeyboardEvent code Notes (Non-normative)
"NumLock" On the Mac, the "NumLock" code should be used for the numpad Clear key.
"Numpad0" 0 Ins on a keyboard
0 on a phone or remote control
"Numpad1" 1 End on a keyboard
1 or 1 QZ on a phone or remote control
"Numpad2" 2 ↓ on a keyboard
2 ABC on a phone or remote control
"Numpad3" 3 PgDn on a keyboard
3 DEF on a phone or remote control
"Numpad4" 4 ← on a keyboard
4 GHI on a phone or remote control
"Numpad5" 5 on a keyboard
5 JKL on a phone or remote control
"Numpad6" 6 → on a keyboard
6 MNO on a phone or remote control
"Numpad7" 7 Home on a keyboard
7 PQRS or 7 PRS on a phone or remote control
"Numpad8" 8 ↑ on a keyboard
8 TUV on a phone or remote control
"Numpad9" 9 PgUp on a keyboard
9 WXYZ or 9 WXY on a phone or remote control
"NumpadAdd" +
"NumpadBackspace" Found on the Microsoft Natural Keyboard.
"NumpadClear" C or AC (All Clear). Also for use with numpads that have a Clear key that is separate from the NumLock key. On the Mac, the numpad Clear key should always be encoded as "NumLock".
"NumpadClearEntry" CE (Clear Entry)
"NumpadComma" , (thousands separator). For locales where the thousands separator is a "." (e.g., Brazil), this key may generate a ..
"NumpadDecimal" . Del. For locales where the decimal separator is "," (e.g., Brazil), this key may generate a ,.
"NumpadDivide" /
"NumpadEnter"
"NumpadEqual" =
"NumpadHash" # on a phone or remote control device. This key is typically found below the 9 key and to the right of the 0 key.
"NumpadMemoryAdd" M+ Add current entry to the value stored in memory.
"NumpadMemoryClear" MC Clear the value stored in memory.
"NumpadMemoryRecall" MR Replace the current entry with the value stored in memory.
"NumpadMemoryStore" MS Replace the value stored in memory with the current entry.
"NumpadMemorySubtract" M- Subtract current entry from the value stored in memory.
"NumpadMultiply" * on a keyboard. For use with numpads that provide mathematical operations (+, -, * and /).
Use "NumpadStar" for the * key on phones and remote controls.
"NumpadParenLeft" ( Found on the Microsoft Natural Keyboard.
"NumpadParenRight" ) Found on the Microsoft Natural Keyboard.
"NumpadStar" * on a phone or remote control device. This key is typically found below the 7 key and to the left of the 0 key.
Use "NumpadMultiply" for the * key on numeric keypads.
"NumpadSubtract" -

For numpads that provide keys not listed here, a code value string should be created by starting with "Numpad" and appending an appropriate description of the key.

3.1.5. Function Section

The function section runs along the top of the keyboard (above the alphanumeric section) and contains the function keys and a few additional special keys (for example, Esc and Print Screen).

A function key is any of the keys labelled F1 ... F12 that an application or operating system can associate with a custom function or action.

On some keyboards (especially those found on laptops or other portable computers), the function keys (F1 ... F12) are defined to have other primary functions (like controlling display brightness or audio volume) and require that a separate Fn key be pressed to make them act as function keys. Unfortunately, the primary functions assigned to these keys varies widely from one manufacturer to the next. Because of this, the code is always set to the function key name.

List of code values for keys in the Function section.
KeyboardEvent code Notes (Non-normative)
"Escape" Esc or
"F1" F1
"F2" F2
"F3" F3
"F4" F4
"F5" F5
"F6" F6
"F7" F7
"F8" F8
"F9" F9
"F10" F10
"F11" F11
"F12" F12
"Fn" Fn This is typically a hardware key that does not generate a separate code. Most keyboards do not place this key in the function section, but it is included here to keep it with related keys.
"FnLock" FLock or FnLock. Function Lock key. Found on the Microsoft Natural Keyboard.
"PrintScreen" PrtScr SysRq or Print Screen
"ScrollLock" Scroll Lock
"Pause" Pause Break

For keyboards that provide more than 12 function keys, the code value follows the pattern shown above with "F" followed by the function key number - "F13", "F14", "F15", and so on.

Apple keyboards may have Eject or Power keys in the function section. The code values for these keys are defined in §3.1.6 Media Keys.

3.1.6. Media Keys

Media keys are extra keys added to a keyboard that provide media related functionality like play, pause or volume control. These keys do not have a standard location on the keyboard so keyboards from different manufacturers are likely to have a different arrangement of keys or a completely different sets of keys.

Media keys are often distinct from normal typing keys in appearance and may be recessed in the keyboard.

On laptop keyboards, these keys are often merged with the function keys, with the media key interpretation being the primary function of the key and the function key interpretation requiring the Fn key to be pressed at the same time. In this configuration the code should be set to match the function key ("F1" ... "F12"). When the keys are merged in this fashion, the code values are taken from the function key value because the media key value is not consistent across keyboards.

List of code values for media keys.
KeyboardEvent code Notes (Non-normative)
"BrowserBack" Some laptops place this key to the left of the key.
"BrowserFavorites"
"BrowserForward" Some laptops place this key to the right of the key.
"BrowserHome"
"BrowserRefresh"
"BrowserSearch"
"BrowserStop"
"Eject" Eject or . This key is placed in the function section on some Apple keyboards.
"LaunchApp1" Sometimes labelled My Computer on the keyboard
"LaunchApp2" Sometimes labelled Calculator on the keyboard
"LaunchMail"
"MediaPlayPause"
"MediaSelect"
"MediaStop"
"MediaTrackNext"
"MediaTrackPrevious"
"Power" This key is placed in the function section on some Apple keyboards, replacing the Eject key.
"Sleep"
"AudioVolumeDown"
"AudioVolumeMute"
"AudioVolumeUp"
"WakeUp"

3.1.7. Legacy, Non-Standard and Special Keys

These keys are not found on modern standard keyboards. They are listed here for reference purposes.

List of code values for legacy modifier keys.
KeyboardEvent code Notes (Non-normative)
"Hyper"
"Super"
"Turbo"

List of code values for legacy process control keys.
KeyboardEvent code Notes (Non-normative)
"Abort"
"Resume"
"Suspend"

List of code values for legacy editing keys.
KeyboardEvent code Notes (Non-normative)
"Again" Found on Sun’s USB keyboard.
"Copy" Found on Sun’s USB keyboard.
"Cut" Found on Sun’s USB keyboard.
"Find" Found on Sun’s USB keyboard.
"Open" Found on Sun’s USB keyboard.
"Paste" Found on Sun’s USB keyboard.
"Props" Found on Sun’s USB keyboard.
"Select" Found on Sun’s USB keyboard.
"Undo" Found on Sun’s USB keyboard.

The following keys may be found on non-standard international keyboards.

List of code values for keys found on international keyboards.
KeyboardEvent code Notes (Non-normative)
"Hiragana" Use for dedicated ひらがな key found on some Japanese word processing keyboards.
"Katakana" Use for dedicated カタカナ key found on some Japanese word processing keyboards.

And finally, the following code value should only be used when the corresponding key does not correspond to any of the code values given elsewhere in this specification. This value is appropriate for use with virtual keyboards that do not have their keys arranged in a way that corresponds to those on a physical keyboard.

List of special code values.
KeyboardEvent code Notes (Non-normative)
"Unidentified" This value code should be used when no other value given in this specification is appropriate.

Conforming implementations MUST only use "Unidentified" as a key code when there is no way for the implementation to determine the key code. Exposing only this value MUST NOT indicate a conforming implementation.

4. Acknowledgements

Considerable thanks are due to the following participants of the WebApps Working Group for providing substantial material contributions in the process of developing this specification.

Gary Kacmarcik (Google), Masayuki Nakano (Mozilla)

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 this specification

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://tools.ietf.org/html/rfc2119
[UIEvents]
Gary Kacmarcik; Travis Leithead. UI Events. 4 August 2016. WD. URL: https://www.w3.org/TR/uievents/
[UIEvents-key]
Gary Kacmarcik; Travis Leithead. UI Events KeyboardEvent key Values. 1 June 2017. CR. URL: https://www.w3.org/TR/uievents-key/

Informative References

[ISO9995-1]
ISO/IEC 9995-1:2009 Information technology -- Keyboard layouts for text and office systems -- Part 1: General principles governing keyboard layouts. URL: http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=51645
[ISO9995-8]
ISO/IEC 9995-8:2009 Information technology -- Keyboard layouts for text and office systems -- Part 8: Allocation of letters to the keys of a numeric keypad. URL: http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=51641
[USB-HID]
USB HID Usage Tables 1.12. URL: http://www.usb.org/developers/hidpage/Hut1_12v2.pdf