Key Values
Special values
Values of key
which have special meanings other than identifying a specific key or character.
Modifier keys
Modifiers are special keys which are used to generate special characters or cause special actions when used in combination with other keys. Examples include the Shift and Control keys, and lock keys such as Caps Lock and NumLock.
[1] In Internet Explorer (tested on release 9 and 11), as well as in all versions of Firefox, the Windows key is reported as "OS"
instead of as "Meta"
. This will be changed in Firefox per bug 1232918. Until that's fixed, these keys are returned as "OS"
by Firefox: VK_LWIN
(0x5B) and VK_RWIN
(0x5C) on Windows, and GDK_KEY_Super_L
(0xFFEB), GDK_KEY_Super_R
(0xFFEC), GDK_KEY_Hyper_L
(0xFFED), and GDK_KEY_Hyper_R
(0xFFEE) on Linux.
[2] Internet Explorer (tested on release 9 and 11) reports "Scroll"
instead of "ScrollLock"
for the Scroll Lock key.
[3] Firefox did not add support for the Symbol key until Firefox 37.
[4] Firefox generates the key value "OS
" for the Super and Hyper keys, instead of "Super"
and "Hyper"
.
[5] Chrome 67 and Firefox 63 now correctly interpret the right Alt key for keyboard layouts which map that key to AltGr. See Firefox bug bug 900750 and Chrome bug 25503 for further details.
Whitespace keys
[1] Older browsers may return "Spacebar"
instead of " "
for the Space Bar key. Firefox did so until version 37, as did Internet Explorer 9, 10, and 11.
Navigation keys
[1] Internet Explorer, Edge (16 and earlier), and Firefox (36 and earlier) use "Left"
, "Right"
, "Up"
, and "Down"
instead of "ArrowLeft"
, "ArrowRight"
, "ArrowUp"
, and "ArrowDown"
.
Editing keys
[1] On keyboards without a dedicated Del key, the Mac generates the "Delete"
value when Fn is pressed in tandem with Delete (which is Backspace on other platforms).
[2] Internet Explorer (tested on release 9 and 11) and Firefox 36 and earlier use "Del"
instead of "Delete"
for the Del key.
[3] Internet Explorer (tested on release 9 and 11) and Firefox 36 and earlier generate the value "Crsel"
instead of "CrSel"
when the CrSel key is pressed.
[4] Internet Explorer (tested on release 9 and 11) and Firefox 36 and earlier generate the value "Exsel"
instead of "ExSel"
when the ExSel key is pressed.
UI keys
[1] In Google Chrome 52, the Cancel key incorrectly returns the key code "Pause"
. This is fixed in Chrome 53. (See Chrome bug 612749 for details.)
[2] In Internet Explorer (tested on release 9 and 11) and Firefox 36 and earlier, the Esc key returns "Esc"
instead of "Escape"
.
[3] Internet Explorer (tested on release 9 and 11) and Firefox 36 and earlier report "Apps"
instead of "ContextMenu"
for the context menu key.
[4] The Attn key generates the key code "Unidentified"
on Internet Explorer (tested on release 9 and 11). Firefox and Google Chrome report the same, unless the Japanese keyboard layout is in effect, in which case it generates "KanaMode"
instead.
[5] The Finish key generates the key code "Unidentified"
on Internet Explorer (tested on release 9 and 11). Firefox reports the same, unless the Japanese keyboard layout is in effect, in which case it generates "Katakana"
instead.
[6] Firefox didn't support the "ZoomIn"
and "ZoomOut"
keys until Firefox 37.
Device keys
[1] The Standby key is not supported by Internet Explorer (tested on release 9 and 11) and Firefox 36 and earlier, so it is reported as "Unidentified"
.
[2] Prior to Firefox 37, this key generated the value "Unidentified"
.
IME and composition keys
Keys used when using an Input Method Editor (IME) to input text which can't readily be entered by simple keypresses, such as text in languages such as those which have more graphemes than there are character entry keys on the keyboard. Common examples include Chinese, Japanese, Korean, and Hindi.
Some keys are common across multiple languages, while others exist only on keyboards targeting specific languages. In addition, not all keyboards have all of these keys.
Common IME keys
[1] On the X Window System, the Compose key is called the Multi key.
[2] The NonConvert key is reported as "Nonconvert"
instead of the correct "NonConvert"
by Internet Explorer (tested on release 9 and 11) and Firefox versions 36 and earlier.
[3] The Process key currently returns "Unidentified"
in Firefox and Internet Explorer. Google Chrome returns the value of the key as if IME were not in use.
[4] Prior to Firefox 37, these keys were "Unidentified"
.
[5] Firefox generates the key value "AltGraph"
instead of "ModeChange"
.
Korean keyboards only
These keys are only available on Korean keyboards. There are other keys defined by various platforms for Korean keyboards, but these are the most common and are the ones identified by the UI Events specification.
[1] VK_HANGUL
and VK_KANA
share the same numeric key value on Windows, as do VK_HANJA
and VK_KANJI
.
Japanese keyboards only
These keys are only available on Japanese keyboards.
[1] Prior to Firefox 37, the Eisu key was mapped to "RomanCharacters"
by mistake.
[2] VK_HANGUL
and VK_KANA
share the same numeric key value on Windows, as do VK_HANJA
and VK_KANJI
.
[3] Prior to Firefox 37, the Hankaku (half-width) key generated the key value "HalfWidth"
on Firefox. Also, this key generates the value "Unidentified"
on Internet Explorer (tested on release 9 and 11).
[4] Internet Explorer (tested on release 9 and 11) reports "Unidentified"
for the Zenkaku key; Firefox 36 and earlier identify this key as "FullWidth"
on Japanese keyboard layouts and "Unidentified"
on all other keyboard layouts. Firefox 37 and later, and all versions of Google Chrome, correctly return "Zenkaku"
.
[5] "Unidentified"
in Internet Explorer (tested on release 9 and 11). Firefox 36 and earlier identify the Romaji key as "RomanCharacters"
on Japanese keyboards and "Unidentified"
for other keyboards; this is corrected to return "Romaji"
in Firefox 37 and later.
[6] This key is reported as "Unidentified"
prior to Firefox 37.
Dead keycodes for Linux
Linux generates accented characters using special dead keys. Dead keys are keys which are pressed in combination with character keys to generate accented forms of those characters. You can identify which specific dead key was used (if more than one exists) by examining the KeyboardEvent
's associated compositionupdate
event's data
property.
You can find a table of the dead keys and the characters they can be used with to generate accented or otherwise special characters on Linux using GTK.
The value of data
will be one of the following:
Function keys
While various platforms support different numbers of the general-purpose function keys, such as F1–F12 (or F1–F10, or F1–F15, etc.), the first few are specifically defined as follows.
If more function keys are available, their names continue the pattern here by continuing to increment the numeric portion of each key's name, so that, for example, "F24"
is a valid key value.
Phone keys
These keys represent buttons which commonly exist on modern smartphones.
[1] Prior to Firefox 37, the Home button generated a key code of "Exit"
. Starting in Firefox 37, the button generates the key code "MozHomeScreen"
.
The multimedia keys are extra buttons or keys for controlling media devices, found on some keyboards.
[1] Internet Explorer, Edge, and Firefox (36 and earlier) use "MediaNextTrack"
and "MediaPreviousTrack"
instead of "MediaTrackNext"
and "MediaTrackPrevious"
.
[2] Prior to Firefox 37, Firefox generated the key code "FastFwd"
on some platforms and "Unidentified"
on others instead of "MediaFastForward"
.
Audio control keys
These media keys are used specifically for controlling audio.
[1] Internet Explorer, Edge, and Firefox (48 and earlier) use "VolumeUp"
, "VolumeDown"
, and "VolumeMute"
instead of "AudioVolumeUp"
, "AudioVolumeDown"
, and "AudioVolumeMute"
. In Firefox 49 they were updated to match the latest specification. The old names are still used on Boot to Gecko.
TV control keys
These key values represent buttons or keys present on television devices, or computers or phones which have TV support.
[1] Firefox added proper support for the "TV"
key in Firefox 37; before that, this key generated the key code "Live"
.
[2] These keys were "Unidentified"
until Firefox 37.
Because modern remote controls for media devices often include buttons beyond the basic controls covered elsewhere in this document, key values are defined for a broad array of these additional buttons.
The values below are derived in part form a number of consumer electronics technical specifications:
Note: Remote controls typically include keys whose values are already defined elsewhere, such as under Multimedia keys or Audio control keys. Those keys' values will match what's documented in those tables.
[1] Don't confuse the media controller VK_APPS
key with the Windows VK_APPS
key, which is also known as VK_CONTEXT_MENU
. That key is encoded as "ContextMenu"
.
[2] Internet Explorer (tested on release 9 and 11) and Firefox 36 and earlier identify the zoom toggle button as "Zoom"
. Firefox 37 corrects this to "ZoomToggle"
.
[3] These keys were "Unidentified"
until Firefox 37.
Speech recognition keys
These special multimedia keys are used to control speech recognition features.
[1] The APPCOMMAND_CORRECTION_LIST
command on Windows generates "Unidentified"
on Firefox.
[2] The APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE
command on Windows generates "Unidentified"
on Firefox.
Document keys
These keys control documents. In the specification, they're included in other sets of keys (such as the media keys), but they are more sensibly considered to be their own category.
[1] Prior to Firefox 37, this key generated the key value "Unidentified"
.
Application selector keys
Some keyboards offer special keys for launching or switching to certain common applications. Key values for those are listed here.
[1] Internet Explorer, Edge, and Firefox (36 and earlier) use "SelectMedia"
instead of "LaunchMediaPlayer"
. Firefox 37 through Firefox 48 use "MediaSelect"
. Firefox 49 has been updated to match the latest specification, and to return "LaunchMediaPlayer"
.
[2] Google Chrome 57 and earlier returned "LaunchMyComputer"
instead of "LaunchApplication1"
. See Chrome Bug 612743 for more information.
[3] Google Chrome 57 and earlier returned "LaunchCalculator"
instead of "LaunchApplication2"
. See Chrome Bug 612743 for more information.
[4] Prior to Firefox 37, Firefox returned the key code "LaunchApplication1"
instead of "LaunchWebBrowser"
for the Web browser key.
[5] Firefox introduced support for this key in Firefox 37. Prior to that, this key was reported as "Unidentified"
.
Browser control keys
Some keyboards include special keys for controlling Web browsers. Those keys follow.
[1] Prior to Firefox 37, this key's value was reported as "Unidentified"
.
Numeric keypad keys
These keys are found on the keyboard's numeric keypad. However, not all are present on every keyboard. Although typical numeric keypads have numeric keys from 0 to 9 (encoded as "0"
through "9"
), some multimedia keyboards include additional number keys for higher numbers.
Note: The 10 key, if present, generates events with the key
value of "0"
.
[1] While older browsers used words like "Add"
, "Decimal"
, "Multiply"
, and so forth modern browsers identify these using the actual character ("+"
, "."
, "*"
, and so forth).