1. Introduction
This document specifies the set of valid key attribute values that MUST be used
in the KeyboardEvent
's key
attribute to encode the key’s
meaning. Note that the key
value for a particular key will differ
based on the user’s current locale setting. For a value that is based only on the key’s
physical location on the keyboard and does not vary based on locale, see code
described in [UIEvents-Code].
1.1. Stylistic Conventions
This specification uses the following conventions:
-
The key cap printed on a key is shown as
↓
,=
orQ
. This is used to refer to a key from the user’s perspective without regard for thekey
andcode
values in the generatedKeyboardEvent
. -
Glyphs representing character are shown as:
"a"
,"é"
,"ر"
,"字"
. -
Unicode [Unicode] code points are shown as:
U+003D
. -
Valid key attribute values (i.e., the value of a
KeyboardEvent
'skey
attribute) are shown as:"ArrowDown"
,"="
,"q"
or"Q"
. -
Valid key code attribute values (i.e., the value of a
KeyboardEvent
'scode
attribute) are shown as:"ArrowDown"
,"Equal"
or"KeyQ"
.
2. Keyboard Event key
Attribute Values
A key attribute value is defined as being a DOMString
that
contains one of the following:
-
A key string that corresponds to the character typed by the user, taking into account the user’s current locale setting, modifier state, and any system-level keyboard mapping overrides that are in effect.
-
A named key attribute value, as defined by the tables in this document.
A key attribute value MUST always contain a value that falls into one of these
two categories (even if the value is "Unidentified"
).
It is acceptable for multiple keys on a keyboard to generate the same key attribute value. For example, on an EN-US keyboard layout, the keys on the
numeric keypad (e.g., the keypad 1
key) will generate the same key attribute values as their non-keypad counterparts (e.g., the 1
key
in the main part of the keyboard). The KeyboardEvent
's location
attribute can be used to determine if a key
originated from the numeric keypad.
2.1. Unicode Values
Almost every Unicode character can be used as a valid key attribute value, but there is a small set of Unicode characters which MUST NOT be used. We introduce the concept of a key string to identify the set of Unicode strings that are appropriate for use as a key attribute value.
A key string is a string containing a 0 or 1 non-control characters ("base" characters) followed by 0 or more combining characters. The string MUST be in Normalized Form C (NFC) as described in [UAX15].
A non-control character is any valid Unicode character except those that are part of the "Other, Control" ("Cc") General Category.
A combining character is any valid Unicode character in the "Mark, Spacing Combining" ("Mc") General Category or with a non-zero Combining Class.
-
"a"
,"A"
,"b"
,"B"
, ...,"å"
,"é"
,"ü"
,"ñ"
-
"@"
,"%"
,"$"
,"*"
, ...,"0"
,"1"
,"2"
-
"あ"
,"日"
,"中"
, ...,"一"
,"二"
,"三"
-
"ا"
,"ب"
,"ة"
,"ت"
, ...,"١"
,"٢"
,"٣"
-
"а"
,"б"
,"в"
,"г"
-
"±"
,"ʶ"
,"϶"
,"൹"
,"℉"
Tab
and Enter
(see § 2.1.1 Control Characters),
all non-control whitespace Unicode characters are considered to
be valid key strings.
-
" "
=U+0020
Space -
" "
=U+00A0
No-Break Space -
" "
=U+2009
Thin Space -
" "
=U+3000
Ideographic Space
-
"ô"
=U+00F4
(NOT "o" + " ̂" (U+006F
U+0302
) because pre-composed characters must be used if available) -
"ḍ̇"
=U+1E0D
+U+0307
(NOT "d" + " ̣" + " ̇" (U+0064
U+0323
U+0307
) because precomposed characters must be used if available, and NOT "ḋ" + " ̣" (U+1E0B
U+0323
) because accents must be ordered before substituting with a precomposed version)
2.1.1. Control Characters
A small number of characters in the Unicode "Cc" General Category are supported as named key attribute values. These named values are as follows:
2.2. Selecting key
Attribute Values
A glyph modifier key is any of the following modifier keys: Shift
, CapsLock
or AltGr
.
2.2.1. select an appropriate key attribute value
To select an appropriate key attribute value to store in aKeyboardEvent
's key
attribute, run these steps:
-
Let key be a DOMString initially set to
"Unidentified"
. -
If there exists an appropriate named key attribute value for this key event, then
-
Set key to that named key attribute value.
-
-
Else, if the key event generates a valid key string, then
-
Set key to that key string value.
-
-
Else, if the key event has any modifier keys other than glyph modifier keys, then
-
Set key to the key string that would have been generated by this event if it had been typed with all modifer keys removed except for glyph modifier keys.
-
-
Return key as the key attribute value for this key event.
On a standard US keyboard, the key attribute value for the key labeled Q
is "q"
(or "Q"
if the Shift
modifier
key is also held).
On a standard US keyboard, key attribute value for Control
+ Q
is "q"
.
On a US keyboard with a right-handed Dvorak key mapping, the key attribute value for the key labeled Q
is "5"
(or "%"
with Shift
modifier).
On the same US Dvorak keyboard layout as the previous example, the key attribute value for Control
+ Q
is "5"
.
On a Bolnagri keyboard layout, the key attribute value for the
key labeled Q
is a string containing the single Unicode
character U+200C
(ZWNJ or Zero Width Non-Joining Space).
On a French PC keyboard with a standard French mapping, the ^
key acts as a dead key for the combining circumflex diacritical mark.
The key attribute value for this keyboard event is "Dead"
.
Also on a French keyboard with a standard French mapping, the key attribute value for the é
key (which corresponds to the 2
key on a US keyboard) is "é"
(U+00E9
).
On a Korean PC keyboard with a standard Korean mapping, the primary
function of the Ha/En
key is to switch between Hangul and English
input. There is an entry for this key as a named key attribute value, "HangulMode"
, so that should be used as the key attribute value.
3. Named key
Attribute Values
A named key attribute value is any of the values given in the key attribute value column of any of the tables in this section of the specification.
The named key attribute values defined here are based
in part on the sets of keycodes from
the java.awt.event.KeyEvent
interface of the Java Platform,
Standard Edition 6 API Specification [KeyEventJava], and the System.Windows.Forms.Keys
key enumeration of the Microsoft .NET
Framework 4.0 Class Library [KeysNet]. Additional information in this spec
comes from Microsoft’s WM_APPCOMMAND messages [WmAppCommand], and other
more specialized specifications as noted in this document.
A conforming implementation of the KeyboardEvent
interface MUST support
this set of values for use in the key
attributes,
although not all values may be available on all platforms or devices.
Future versions of this specification may include key
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 named key 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. Special Keys
Implementations that are unable to identify a key MUST use "Unidentified"
as the the key attribute value.
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"Unidentified"
| Yes | This key value is used when an implementation is unable to identify another key value, due to either hardware, platform, or software constraints. |
Conforming implementations MUST only use "Unidentified"
as a key value
when there is no way for the implementation to detect the key value.
Exposing only this value for all keyboard events MUST NOT indicate a conforming
implementation.
3.2. Modifier Keys
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"Alt"
| Yes | The Alt (Alternative) key.This key enables the alternate modifier function for interpreting concurrent or subsequent keyboard input. This key value is also used for the Apple Option key.
|
"AltGraph"
| Yes | The Alternate Graphics (AltGr or AltGraph ) key. This key is used enable the ISO Level 3 shift modifier (the standard Shift key is the level 2 modifier).
See [ISO9995-1].
|
"CapsLock"
| Yes | The Caps Lock (Capital) key. Toggle capital character lock function for interpreting subsequent keyboard input event.
|
"Control"
| Yes | The Control or Ctrl key, to enable control modifier function for interpreting concurrent or subsequent keyboard input.
|
"Fn"
| No | The Function switch Fn key.Activating this key simultaneously with another key changes that key’s value to an alternate character or function. This key is often handled directly in the keyboard hardware and does not usually generate key events. |
"FnLock"
| No | The Function-Lock (FnLock or F-Lock ) key. Activating this key switches the mode of the keyboard to changes some keys' values to an alternate character or function.
This key is often handled directly in the keyboard hardware and does not usually generate key events.
|
"Meta"
| Yes | The Meta key, to enable meta modifier function for interpreting concurrent or subsequent keyboard input. This key value is used for the Windows Logokey and the Apple Command or ⌘ key.
|
"NumLock"
| Yes | The NumLock or Number Lock key, to toggle numpad mode function for interpreting subsequent keyboard input.
|
"ScrollLock"
| Yes | The Scroll Lock key, to toggle between scrolling and cursor movement modes.
|
"Shift"
| Yes | The Shift key, to enable shift modifier function for interpreting concurrent or subsequent keyboard input.
|
"Symbol"
| No | The Symbol modifier key (used on some virtual keyboards). |
"SymbolLock"
| No | The Symbol Lock key. |
Legacy modifier keys:
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"Hyper"
| No | The Hyper key.
|
"Super"
| No | The Super key.
|
3.3. Whitespace Keys
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"Enter"
| Yes | The Enter or ↵ key, to activate current selection or accept current input.This key value is also used for the Return (Macintosh numpad) key.This key value is also used for the Android KEYCODE_DPAD_CENTER .
|
"Tab"
| Yes | The Horizontal Tabulation Tab key.
|
The space or spacebar key is encoded as " "
.
3.4. Navigation Keys
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"ArrowDown"
| Yes | The down arrow key, to navigate or traverse downward. (KEYCODE_DPAD_DOWN )
|
"ArrowLeft"
| Yes | The left arrow key, to navigate or traverse leftward. (KEYCODE_DPAD_LEFT )
|
"ArrowRight"
| Yes | The right arrow key, to navigate or traverse rightward. (KEYCODE_DPAD_RIGHT )
|
"ArrowUp"
| Yes | The up arrow key, to navigate or traverse upward. (KEYCODE_DPAD_UP )
|
"End"
| Yes | The End key, used with keyboard entry to go to the end of content (KEYCODE_MOVE_END ).
|
"Home"
| Yes | The Home key, used with keyboard entry, to go to start of content (KEYCODE_MOVE_HOME ).For the mobile phone Home key (which goes to the phone’s main screen), use "GoHome" .
|
"PageDown"
| Yes | The Page Down key, to scroll down or display next page of content. |
"PageUp"
| Yes | The Page Up key, to scroll up or display previous page of content. |
3.5. Editing Keys
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"Backspace"
| Yes | The Backspace key. This key value is also used for the key labeled Delete on MacOS keyboards.
|
"Clear"
| No | Remove the currently selected input. |
"Copy"
| No | Copy the current selection. (APPCOMMAND_COPY )
|
"CrSel"
| No | The Cursor Select (Crsel) key. |
"Cut"
| No | Cut the current selection. (APPCOMMAND_CUT )
|
"Delete"
| Yes | The Delete (Del) Key. This key value is also used for the key labeled Delete on MacOS keyboards when modified by the Fn key.
|
"EraseEof"
| No | The Erase to End of Field key. This key deletes all characters from the current cursor position to the end of the current field. |
"ExSel"
| No | The Extend Selection (Exsel) key. |
"Insert"
| Yes | The Insert (Ins) key, to toggle between text modes for insertion or overtyping. (KEYCODE_INSERT )
|
"Paste"
| No | The Paste key. (APPCOMMAND_PASTE )
|
"Redo"
| No | Redo the last action. (APPCOMMAND_REDO )
|
"Undo"
| No | Undo the last action. (APPCOMMAND_UNDO )
|
3.6. UI Keys
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"Accept"
| No | The Accept (Commit, OK) key. Accept current option or input method sequence conversion. |
"Again"
| No | The Again key, to redo or repeat an action. |
"Attn"
| No | The Attention (Attn) key. |
"Cancel"
| No | The Cancel key. |
"ContextMenu"
| Yes | Show the application’s context menu. This key is commonly found between the right Meta key and the right Control key.
|
"Escape"
| Yes | The Esc key. This key was originally used to initiate an escape sequence, but is now more generally used to exit or "escape" the current context, such as closing a dialog
or exiting full screen mode.
|
"Execute"
| No | The Execute key. |
"Find"
| No | Open the Find dialog. (APPCOMMAND_FIND )
|
"Help"
| Yes | Open a help dialog or toggle display of help information. ( , )
|
"Pause"
| Yes |
Pause the current state or application (as appropriate).
Do not use this value for the |
"Play"
| No |
Play or resume the current state or application (as appropriate).
Do not use this value for the |
"Props"
| No | The properties (Props) key. |
"Select"
| No | The Select key. |
"ZoomIn"
| No | The ZoomIn key. (KEYCODE_ZOOM_IN )
|
"ZoomOut"
| No | The ZoomOut key. (KEYCODE_ZOOM_OUT )
|
3.7. Device Keys
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"BrightnessDown"
| No | The Brightness Down key. Typically controls the display brightness. (KEYCODE_BRIGHTNESS_DOWN )
|
"BrightnessUp"
| No | The Brightness Up key. Typically controls the display brightness. (KEYCODE_BRIGHTNESS_UP )
|
"Eject"
| No | Toggle removable media to eject (open) and insert (close) state. (KEYCODE_MEDIA_EJECT )
|
"LogOff"
| No | The LogOff key. |
"Power"
| No |
Toggle power state. (KEYCODE_POWER )
Note: Some devices might not expose this key to the operating environment. |
"PowerOff"
| No | The PowerOff key. Sometime called PowerDown .
|
"PrintScreen"
| Yes | The Print Screen or SnapShot key, to initiate print-screen function.
|
"Hibernate"
| No | The Hibernate key. This key saves the current state of the computer to disk so that it can be restored. The computer will then shutdown. |
"Standby"
| No | The Standby key. This key turns off the display and places the computer into a low-power mode without completely shutting down.
It is sometimes labelled Suspend or Sleep key. ( )
|
"WakeUp"
| No | The WakeUp key. (KEYCODE_WAKEUP )
|
3.8. IME and Composition Keys
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"AllCandidates"
| No | The All Candidates key, to initate the multi-candidate mode. |
"Alphanumeric"
| No | The Alphanumeric key. |
"CodeInput"
| No | The Code Input key, to initiate the Code Input mode to allow characters to be entered by their code points. |
"Compose"
| No | The Compose key, also known as Multi_key on the X Window System. This key acts in a manner similar to a dead key, triggering a mode where subsequent key presses are combined to produce a different character. |
"Convert"
| No | The Convert key, to convert the current input method sequence. |
"Dead"
| No | A dead key combining key. It may be any combining key from any keyboard layout. For example, on a PC/AT French keyboard, using a French mapping and without any modifier activiated, this is the key value U+0302 COMBINING CIRCUMFLEX ACCENT. In another layout this might be a different unicode combining key.For applications that need to differentiate between specific combining characters, the associated compositionupdate event’s data attribute provides the specific key value. |
"FinalMode"
| No | The Final Mode Final key used on some Asian keyboards, to enable the final mode for IMEs.
|
"GroupFirst"
| No | Switch to the first character group. (ISO/IEC 9995) |
"GroupLast"
| No | Switch to the last character group. (ISO/IEC 9995) |
"GroupNext"
| No | Switch to the next character group. (ISO/IEC 9995) |
"GroupPrevious"
| No | Switch to the previous character group. (ISO/IEC 9995) |
"ModeChange"
| No | The Mode Change key, to toggle between or cycle through input modes of IMEs. |
"NextCandidate"
| No | The Next Candidate function key. |
"NonConvert"
| No | The NonConvert ("Don’t Convert") key, to accept current input method sequence without conversion in IMEs. |
"PreviousCandidate"
| No | The Previous Candidate function key. |
"Process"
| No | The Process key. |
"SingleCandidate"
| No | The Single Candidate function key. |
Keys specific to Korean keyboards:
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"HangulMode"
| No | The Hangul (Korean characters) Mode key, to toggle between Hangul and English modes. |
"HanjaMode"
| No | The Hanja (Korean characters) Mode key. |
"JunjaMode"
| No | The Junja (Korean characters) Mode key. |
Keys specific to Japanese keyboards:
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"Eisu"
| No | The Eisu key. This key may close the IME, but its purpose is defined by the current IME. (KEYCODE_EISU )
|
"Hankaku"
| No | The (Half-Width) Characters key. |
"Hiragana"
| No | The Hiragana (Japanese Kana characters) key. |
"HiraganaKatakana"
| No | The Hiragana/Katakana toggle key. (KEYCODE_KATAKANA_HIRAGANA )
|
"KanaMode"
| No | The Kana Mode (Kana Lock) key. This key is used to enter hiragana mode (typically from romaji mode). |
"KanjiMode"
| No | The Kanji (Japanese name for ideographic characters of Chinese origin) Mode key. This key is typically used to switch to a hiragana keyboard for
the purpose of converting input into kanji. (KEYCODE_KANA )
|
"Katakana"
| No | The Katakana (Japanese Kana characters) key. |
"Romaji"
| No | The Roman characters function key. |
"Zenkaku"
| No | The Zenkaku (Full-Width) Characters key. |
"ZenkakuHankaku"
| No | The Zenkaku/Hankaku (full-width/half-width) toggle key. (KEYCODE_ZENKAKU_HANKAKU )
|
3.9. General-Purpose Function Keys
The exact number of these general purpose function keys varies on different
platforms, and only the first few are defined explicitly here. Additional
function key names are implicitly defined by incrementing the base-10 index at
the end of the function key name. Thus, "F24"
and "Soft8"
are all valid key values.
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"F1"
| Yes | The F1 key, a general purpose function key, as index 1. |
"F2"
| Yes | The F2 key, a general purpose function key, as index 2. |
"F3"
| Yes | The F3 key, a general purpose function key, as index 3. |
"F4"
| Yes | The F4 key, a general purpose function key, as index 4. |
"F5"
| Yes | The F5 key, a general purpose function key, as index 5. |
"F6"
| Yes | The F6 key, a general purpose function key, as index 6. |
"F7"
| Yes | The F7 key, a general purpose function key, as index 7. |
"F8"
| Yes | The F8 key, a general purpose function key, as index 8. |
"F9"
| Yes | The F9 key, a general purpose function key, as index 9. |
"F10"
| Yes | The F10 key, a general purpose function key, as index 10. |
"F11"
| Yes | The F11 key, a general purpose function key, as index 11. |
"F12"
| Yes | The F12 key, a general purpose function key, as index 12. |
"Soft1"
| No | General purpose virtual function key, as index 1. |
"Soft2"
| No | General purpose virtual function key, as index 2. |
"Soft3"
| No | General purpose virtual function key, as index 3. |
"Soft4"
| No | General purpose virtual function key, as index 4. |
3.10. Multimedia Keys
These are extra keys found on "multimedia" keyboards.
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"ChannelDown"
| No | Select next (numerically or logically) lower channel. ( , )
|
"ChannelUp"
| No | Select next (numerically or logically) higher channel. ( , )
|
"Close"
| No | Close the current document or message (Note: This doesn’t close the application). (APPCOMMAND_CLOSE )
|
"MailForward"
| No | Open an editor to forward the current message. (APPCOMMAND_FORWARD_MAIL )
|
"MailReply"
| No | Open an editor to reply to the current message. (APPCOMMAND_REPLY_TO_MAIL )
|
"MailSend"
| No | Send the current message. (APPCOMMAND_SEND_MAIL )
|
"MediaClose"
| No | Close the current media, for example to close a CD or DVD tray. (KEYCODE_MEDIA_CLOSE )
|
"MediaFastForward"
| No | Initiate or continue forward playback at faster than normal speed, or increase speed if already fast forwarding. ( , )
|
"MediaPause"
| No |
Pause the currently playing media. ( , )
Media controller devices should use this value rather than |
"MediaPlay"
| No | Initiate or continue media playback at normal speed, if not currently playing at normal speed. ( , )
|
"MediaPlayPause"
| No | Toggle media between play and pause states. ( , )
|
"MediaRecord"
| No | Initiate or resume recording of currently selected media. ( , )
|
"MediaRewind"
| No | Initiate or continue reverse playback at faster than normal speed, or increase speed if already rewinding. ( , )
|
"MediaStop"
| No | Stop media playing, pausing, forwarding, rewinding, or recording, if not already stopped. ( , )
|
"MediaTrackNext"
| No | Seek to next media or program track. ( , )
|
"MediaTrackPrevious"
| No | Seek to previous media or program track. ( , )
|
"New"
| No | Open a new document or message. (APPCOMMAND_NEW )
|
"Open"
| No | Open an existing document or message. (APPCOMMAND_OPEN )
|
"Print"
| No | Print the current document or message. (APPCOMMAND_PRINT )
|
"Save"
| No | Save the current document or message. (APPCOMMAND_SAVE )
|
"SpellCheck"
| No | Spellcheck the current document or selection. (APPCOMMAND_SPELL_CHECK )
|
3.11. Multimedia Numpad Keys
The normal 0
... 9
numpad keys
are encoded as "0"
... "9"
, but some
multimedia keypads have buttons numbered from 1
... 12
.
In these instances, the 10
key is often labeled 10 /0
.
Note: If supported, the 10
or 10 /0
key MUST be assigned a key
value of "0"
.
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"Key11"
| No | The 11 key found on media numpads that have buttons from 1 ... 12 .
|
"Key12"
| No | The 12 key found on media numpads that have buttons from 1 ... 12 .
|
3.12. Audio Keys
Multimedia keys related to audio.
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"AudioBalanceLeft"
| No | Adjust audio balance leftward. (VK_AUDIO_BALANCE_LEFT )
|
"AudioBalanceRight"
| No | Adjust audio balance rightward. (VK_AUDIO_BALANCE_RIGHT )
|
"AudioBassBoostDown"
| No | Decrease audio bass boost or cycle down through bass boost states. ( , )
|
"AudioBassBoostToggle"
| No | Toggle bass boost on/off. (APPCOMMAND_BASS_BOOST )
|
"AudioBassBoostUp"
| No | Increase audio bass boost or cycle up through bass boost states. ( , )
|
"AudioFaderFront"
| No | Adjust audio fader towards front. (VK_FADER_FRONT )
|
"AudioFaderRear"
| No | Adjust audio fader towards rear. (VK_FADER_REAR )
|
"AudioSurroundModeNext"
| No | Advance surround audio mode to next available mode. (VK_SURROUND_MODE_NEXT )
|
"AudioTrebleDown"
| No | Decrease treble. (APPCOMMAND_TREBLE_DOWN )
|
"AudioTrebleUp"
| No | Increase treble. (APPCOMMAND_TREBLE_UP )
|
"AudioVolumeDown"
| No | Decrease audio volume. ( , )
|
"AudioVolumeUp"
| No | Increase audio volume. ( , )
|
"AudioVolumeMute"
| No | Toggle between muted state and prior volume level. ( , )
|
"MicrophoneToggle"
| No | Toggle the microphone on/off. (APPCOMMAND_MIC_ON_OFF_TOGGLE )
|
"MicrophoneVolumeDown"
| No | Decrease microphone volume. (APPCOMMAND_MICROPHONE_VOLUME_DOWN )
|
"MicrophoneVolumeUp"
| No | Increase microphone volume. (APPCOMMAND_MICROPHONE_VOLUME_UP )
|
"MicrophoneVolumeMute"
| No | Mute the microphone. ( , )
|
3.13. Speech Keys
Multimedia keys related to speech recognition.
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"SpeechCorrectionList"
| No | Show correction list when a word is incorrectly identified. (APPCOMMAND_CORRECTION_LIST )
|
"SpeechInputToggle"
| No | Toggle between dictation mode and command/control mode. (APPCOMMAND_DICTATE_OR_COMMAND_CONTROL_TOGGLE )
|
3.14. Application Keys
The Application Keys are special keys that are assigned to launch a particular application. Additional application key names can be defined by concatenating "Launch" with the name of the application.
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"LaunchApplication1"
| No | The first generic "LaunchApplication" key. This is commonly associated with launching "My Computer", and may have a computer symbol on the key. (APPCOMMAND_LAUNCH_APP1 )
|
"LaunchApplication2"
| No | The second generic "LaunchApplication" key. This is commonly associated with launching "Calculator", and may have a calculator symbol on the key. ( , )
|
"LaunchCalendar"
| No | The "Calendar" key. (KEYCODE_CALENDAR )
|
"LaunchContacts"
| No | The "Contacts" key. (KEYCODE_CONTACTS )
|
"LaunchMail"
| No | The "Mail" key. (APPCOMMAND_LAUNCH_MAIL )
|
"LaunchMediaPlayer"
| No | The "Media Player" key. (APPCOMMAND_LAUNCH_MEDIA_SELECT )
|
"LaunchMusicPlayer"
| No | The "Music Player" key. |
"LaunchPhone"
| No | The "Phone" key. |
"LaunchScreenSaver"
| No | The "Screen Saver" key. |
"LaunchSpreadsheet"
| No | The "Spreadsheet" key. |
"LaunchWebBrowser"
| No | The "Web Browser" key. |
"LaunchWebCam"
| No | The "WebCam" key. |
"LaunchWordProcessor"
| No | The "Word Processor" key. |
3.15. Browser Keys
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"BrowserBack"
| No | Navigate to previous content or page in current history. (APPCOMMAND_BROWSER_BACKWARD )
|
"BrowserFavorites"
| No | Open the list of browser favorites. (APPCOMMAND_BROWSER_FAVORITES )
|
"BrowserForward"
| No | Navigate to next content or page in current history. (APPCOMMAND_BROWSER_FORWARD )
|
"BrowserHome"
| No | Go to the user’s preferred home page. (APPCOMMAND_BROWSER_HOME )
|
"BrowserRefresh"
| No | Refresh the current page or content. (APPCOMMAND_BROWSER_REFRESH )
|
"BrowserSearch"
| No | Call up the user’s preferred search page. (APPCOMMAND_BROWSER_SEARCH )
|
"BrowserStop"
| No | Stop loading the current page or content. (APPCOMMAND_BROWSER_STOP )
|
3.16. Mobile Phone Keys
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"AppSwitch"
| No | The Application switch key, which provides a list of recent apps to switch between. (KEYCODE_APP_SWITCH )
|
"Call"
| No | The Call key. (KEYCODE_CALL )
|
"Camera"
| No | The Camera key. (KEYCODE_CAMERA )
|
"CameraFocus"
| No | The Camera focus key. (KEYCODE_FOCUS )
|
"EndCall"
| No | The End Call key. (KEYCODE_ENDCALL )
|
"GoBack"
| No | The Back key. (KEYCODE_BACK )
|
"GoHome"
| No | The Home key, which goes to the phone’s main screen. (KEYCODE_HOME )
|
"HeadsetHook"
| No | The Headset Hook key. (KEYCODE_HEADSETHOOK )
|
"LastNumberRedial"
| No | The Last Number Redial key. |
"Notification"
| No | The Notification key. (KEYCODE_NOTIFICATION )
|
"MannerMode"
| No | Toggle between manner mode state: silent, vibrate, ring, ... (KEYCODE_MANNER_MODE )
|
"VoiceDial"
| No | The Voice Dial key. |
3.17. TV Keys
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"TV"
| No | Switch to viewing TV. (KEYCODE_TV )
|
"TV3DMode"
| No | TV 3D Mode. (KEYCODE_3D_MODE )
|
"TVAntennaCable"
| No | Toggle between antenna and cable input. (KEYCODE_TV_ANTENNA_CABLE )
|
"TVAudioDescription"
| No | Audio description. (KEYCODE_TV_AUDIO_DESCRIPTION )
|
"TVAudioDescriptionMixDown"
| No | Audio description mixing volume down. (KEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN )
|
"TVAudioDescriptionMixUp"
| No | Audio description mixing volume up. (KEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP )
|
"TVContentsMenu"
| No | Contents menu. (KEYCODE_TV_CONTENTS_MENU )
|
"TVDataService"
| No | Contents menu. (KEYCODE_TV_DATA_SERVICE )
|
"TVInput"
| No | Switch the input mode on an external TV. (KEYCODE_TV_INPUT )
|
"TVInputComponent1"
| No | Switch to component input #1. (KEYCODE_TV_INPUT_COMPONENT_1 )
|
"TVInputComponent2"
| No | Switch to component input #2. (KEYCODE_TV_INPUT_COMPONENT_2 )
|
"TVInputComposite1"
| No | Switch to composite input #1. (KEYCODE_TV_INPUT_COMPOSITE_1 )
|
"TVInputComposite2"
| No | Switch to composite input #2. (KEYCODE_TV_INPUT_COMPOSITE_2 )
|
"TVInputHDMI1"
| No | Switch to HDMI input #1. (KEYCODE_TV_INPUT_HDMI_1 )
|
"TVInputHDMI2"
| No | Switch to HDMI input #2. (KEYCODE_TV_INPUT_HDMI_2 )
|
"TVInputHDMI3"
| No | Switch to HDMI input #3. (KEYCODE_TV_INPUT_HDMI_3 )
|
"TVInputHDMI4"
| No | Switch to HDMI input #4. (KEYCODE_TV_INPUT_HDMI_4 )
|
"TVInputVGA1"
| No | Switch to VGA input #1. (KEYCODE_TV_INPUT_VGA_1 )
|
"TVMediaContext"
| No | Media context menu. (KEYCODE_TV_MEDIA_CONTEXT_MENU )
|
"TVNetwork"
| No | Toggle network. (KEYCODE_TV_NETWORK )
|
"TVNumberEntry"
| No | Number entry. (KEYCODE_TV_NUMBER_ENTRY )
|
"TVPower"
| No | Toggle the power on an external TV. (KEYCODE_TV_POWER )
|
"TVRadioService"
| No | Radio. (KEYCODE_TV_RADIO_SERVICE )
|
"TVSatellite"
| No | Satellite. (KEYCODE_TV_SATELLITE )
|
"TVSatelliteBS"
| No | Broadcast Satellite. (KEYCODE_TV_SATELLITE_BS )
|
"TVSatelliteCS"
| No | Communication Satellite. (KEYCODE_TV_SATELLITE_CS )
|
"TVSatelliteToggle"
| No | Toggle between available satellites. (KEYCODE_TV_SATELLITE_SERVICE )
|
"TVTerrestrialAnalog"
| No | Analog Terrestrial. (KEYCODE_TV_TERRESTRIAL_ANALOG )
|
"TVTerrestrialDigital"
| No | Digital Terrestrial. (KEYCODE_TV_TERRESTRIAL_DIGITAL )
|
"TVTimer"
| No | Timer programming. (KEYCODE_TV_TIMER_PROGRAMMING )
|
3.18. Media Controller Keys
The key attribute values for media controllers (e.g. remote controls for television, audio systems, and set-top boxes) are derived in part from the consumer electronics technical specifications:
-
DTV Application Software Environment [DASE]
-
Open Cable Application Platform 1.1.3 [OCAP]
-
ANSI/CTA-2014-B, Web-based Protocol and Framework for Remote User Interface on UPnP Networks and the Internet [WEB4CE]
-
Android KeyEvent KEYCODEs [AndroidKeycode]
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"AVRInput"
| No | Switch the input mode on an external AVR (audio/video receiver). (KEYCODE_AVR_INPUT )
|
"AVRPower"
| No | Toggle the power on an external AVR (audio/video receiver). (KEYCODE_AVR_POWER )
|
"ColorF0Red"
| No | General purpose color-coded media function key, as index 0 (red). ( , )
|
"ColorF1Green"
| No | General purpose color-coded media function key, as index 1 (green). ( , )
|
"ColorF2Yellow"
| No | General purpose color-coded media function key, as index 2 (yellow). ( , )
|
"ColorF3Blue"
| No | General purpose color-coded media function key, as index 3 (blue). ( , )
|
"ColorF4Grey"
| No | General purpose color-coded media function key, as index 4 (grey). (VK_COLORED_KEY_4 )
|
"ColorF5Brown"
| No | General purpose color-coded media function key, as index 5 (brown). (VK_COLORED_KEY_5 )
|
"ClosedCaptionToggle"
| No | Toggle the display of Closed Captions. ( , )
|
"Dimmer"
| No | Adjust brightness of device, by toggling between or cycling through states. (VK_DIMMER )
|
"DisplaySwap"
| No | Swap video sources. (VK_DISPLAY_SWAP )
|
"DVR"
| No | Select Digital Video Rrecorder. (KEYCODE_DVR )
|
"Exit"
| No | Exit the current application. (VK_EXIT )
|
"FavoriteClear0"
| No | Clear program or content stored as favorite 0. (VK_CLEAR_FAVORITE_0 )
|
"FavoriteClear1"
| No | Clear program or content stored as favorite 1. (VK_CLEAR_FAVORITE_1 )
|
"FavoriteClear2"
| No | Clear program or content stored as favorite 2. (VK_CLEAR_FAVORITE_2 )
|
"FavoriteClear3"
| No | Clear program or content stored as favorite 3. (VK_CLEAR_FAVORITE_3 )
|
"FavoriteRecall0"
| No | Select (recall) program or content stored as favorite 0. (VK_RECALL_FAVORITE_0 )
|
"FavoriteRecall1"
| No | Select (recall) program or content stored as favorite 1. (VK_RECALL_FAVORITE_1 )
|
"FavoriteRecall2"
| No | Select (recall) program or content stored as favorite 2. (VK_RECALL_FAVORITE_2 )
|
"FavoriteRecall3"
| No | Select (recall) program or content stored as favorite 3. (VK_RECALL_FAVORITE_3 )
|
"FavoriteStore0"
| No | Store current program or content as favorite 0. (VK_STORE_FAVORITE_0 )
|
"FavoriteStore1"
| No | Store current program or content as favorite 1. (VK_STORE_FAVORITE_1 )
|
"FavoriteStore2"
| No | Store current program or content as favorite 2. (VK_STORE_FAVORITE_2 )
|
"FavoriteStore3"
| No | Store current program or content as favorite 3. (VK_STORE_FAVORITE_3 )
|
"Guide"
| No | Toggle display of program or content guide. ( , )
|
"GuideNextDay"
| No | If guide is active and displayed, then display next day’s content. (VK_NEXT_DAY )
|
"GuidePreviousDay"
| No | If guide is active and displayed, then display previous day’s content. (VK_PREV_DAY )
|
"Info"
| No | Toggle display of information about currently selected context or media. ( , )
|
"InstantReplay"
| No | Toggle instant replay. (VK_INSTANT_REPLAY )
|
"Link"
| No | Launch linked content, if available and appropriate. (VK_LINK )
|
"ListProgram"
| No | List the current program. (VK_LIST )
|
"LiveContent"
| No | Toggle display listing of currently available live content or programs. (VK_LIVE )
|
"Lock"
| No | Lock or unlock current content or program. (VK_LOCK )
|
"MediaApps"
| No |
Show a list of media applications: audio/video players and image viewers. (VK_APPS )
Do not confuse this key value with the Windows' |
"MediaAudioTrack"
| No | Audio track key. (KEYCODE_MEDIA_AUDIO_TRACK )
|
"MediaLast"
| No | Select previously selected channel or media. ( , )
|
"MediaSkipBackward"
| No | Skip backward to next content or program. (KEYCODE_MEDIA_SKIP_BACKWARD )
|
"MediaSkipForward"
| No | Skip forward to next content or program. ( , )
|
"MediaStepBackward"
| No | Step backward to next content or program. (KEYCODE_MEDIA_STEP_BACKWARD )
|
"MediaStepForward"
| No | Step forward to next content or program. (KEYCODE_MEDIA_STEP_FORWARD )
|
"MediaTopMenu"
| No | Media top menu. (KEYCODE_MEDIA_TOP_MENU )
|
"NavigateIn"
| No | Navigate in. (KEYCODE_NAVIGATE_IN )
|
"NavigateNext"
| No | Navigate to next key. (KEYCODE_NAVIGATE_NEXT )
|
"NavigateOut"
| No | Navigate out. (KEYCODE_NAVIGATE_OUT )
|
"NavigatePrevious"
| No | Navigate to previous key. (KEYCODE_NAVIGATE_PREVIOUS )
|
"NextFavoriteChannel"
| No | Cycle to next favorite channel (in favorites list). (VK_NEXT_FAVORITE_CHANNEL )
|
"NextUserProfile"
| No | Cycle to next user profile (if there are multiple user profiles). (VK_USER )
|
"OnDemand"
| No | Access on-demand content or programs. (VK_ON_DEMAND )
|
"Pairing"
| No | Pairing key to pair devices. (KEYCODE_PAIRING )
|
"PinPDown"
| No | Move picture-in-picture window down. (VK_PINP_DOWN )
|
"PinPMove"
| No | Move picture-in-picture window. (VK_PINP_MOVE )
|
"PinPToggle"
| No | Toggle display of picture-in-picture window. (VK_PINP_TOGGLE )
|
"PinPUp"
| No | Move picture-in-picture window up. (VK_PINP_UP )
|
"PlaySpeedDown"
| No | Decrease media playback speed. (VK_PLAY_SPEED_DOWN )
|
"PlaySpeedReset"
| No | Reset playback to normal speed. (VK_PLAY_SPEED_RESET )
|
"PlaySpeedUp"
| No | Increase media playback speed. (VK_PLAY_SPEED_UP )
|
"RandomToggle"
| No | Toggle random media or content shuffle mode. (VK_RANDOM_TOGGLE )
|
"RcLowBattery"
| No | Not a physical key, but this key code is sent when the remote control battery is low. (VK_RC_LOW_BATTERY )
|
"RecordSpeedNext"
| No | Toggle or cycle between media recording speeds. (VK_RECORD_SPEED_NEXT )
|
"RfBypass"
| No | Toggle RF (radio frequency) input bypass mode (pass RF input directly to the RF output). (VK_RF_BYPASS )
|
"ScanChannelsToggle"
| No | Toggle scan channels mode. (VK_SCAN_CHANNELS_TOGGLE )
|
"ScreenModeNext"
| No | Advance display screen mode to next available mode. (VK_SCREEN_MODE_NEXT )
|
"Settings"
| No | Toggle display of device settings screen. ( , )
|
"SplitScreenToggle"
| No | Toggle split screen mode. (VK_SPLIT_SCREEN_TOGGLE )
|
"STBInput"
| No | Switch the input mode on an external STB (set top box). (KEYCODE_STB_INPUT )
|
"STBPower"
| No | Toggle the power on an external STB (set top box). (KEYCODE_STB_POWER )
|
"Subtitle"
| No | Toggle display of subtitles, if available. (VK_SUBTITLE )
|
"Teletext"
| No | Toggle display of teletext, if available ( , ).
|
"VideoModeNext"
| No | Advance video mode to next available mode. (VK_VIDEO_MODE_NEXT )
|
"Wink"
| No | Cause device to identify itself in some manner, e.g., audibly or visibly. (VK_WINK )
|
"ZoomToggle"
| No | Toggle between full-screen and scaled content, or alter magnification level. ( , )
|
Some of the keys defined in the media controller standards already have appropriate keys defined in other sections of this specification. These following table summarizes the key values that MUST be used if these keys are supported:
key attribute value | Required | Typical Usage (Non-normative) |
---|---|---|
"AudioVolumeDown"
| No | Decrease audio volume. (VK_VOLUME_DOWN )
|
"AudioVolumeUp"
| No | Increase audio volume. (VK_VOLUME_UP )
|
"AudioVolumeMute"
| No | Toggle between muted state and prior volume level. (VK_VOLUME_MUTE )
|
"BrowserBack"
| No | Navigate to previous content or page in current history. (VK_BACK )
|
"BrowserForward"
| No | Navigate to next content or page in current history. (VK_FORWARD )
|
"ChannelDown"
| No | Select next (numerically or logically) lower channel. (VK_CHANNEL_DOWN )
|
"ChannelUp"
| No | Select next (numerically or logically) higher channel. (VK_CHANNEL_UP )
|
"ContextMenu"
| Yes | Toggle display of the on-screen menu. (VK_MENU )
|
"Eject"
| No | Toggle removable media to eject (open) and insert (close) state. (VK_EJECT_TOGGLE )
|
"End"
| Yes | The End key, used with keyboard entry to go to the end of content. (VK_GO_TO_END )
|
"Enter"
| Yes | The Enter key, to activate current selection or accept current input. (VK_SELECT )
|
"Home"
| Yes | The Home key, used with keyboard entry, to go to start of content. (VK_GO_TO_START )
|
"MediaFastForward"
| No | Initiate or continue forward playback at faster than normal speed, or increase speed if already fast forwarding. (VK_FAST_FWD )
|
"MediaPlay"
| No | Initiate or continue media playback at normal speed, if not currently playing at normal speed. (VK_PLAY )
|
"MediaPlayPause"
| No | Toggle media between play and pause states. (VK_PLAY_PAUSE )
|
"MediaRecord"
| No | Initiate or resume recording of currently selected media. (VK_RECORD )
|
"MediaRewind"
| No | Initiate or continue reverse playback at faster than normal speed, or increase speed if already rewinding. (VK_REWIND )
|
"MediaStop"
| No | Stop media playing, pausing, forwarding, rewinding, or recording, if not already stopped. (VK_STOP )
|
"MediaNextTrack"
| No | Seek to next media or program track. (VK_TRACK_NEXT )
|
"MediaPause"
| No | Pause the currently playing media. (VK_PAUSE )
|
"MediaPreviousTrack"
| No | Seek to previous media or program track. (VK_TRACK_PREV )
|
"Power"
| No | Toggle power state. (VK_POWER )
|
"Unidentified"
| Yes | This key value is used when an implementations is unable to identify another key value, due to either hardware, platform, or software constraints. (VK_UNDEFINED )
|
4. Accessibility
This specification simply defines a set of values that are valid for use in the key
attribute. Thus, it does not introduce any features that have
accessibility concerns.
The FAST checklist has been completed and nothing is applicable to this specification.
A note related to the FAST checklist item: "If technology provides internationalization support".
This specification inherently defines key
values that support international hardware, e.g.,
keyboards for different languages or layouts. It also defines many special keys which are given
human-readable names (like "Shift", "Control", "Home" or "ArrowLeft").
These special key values are defined as human-readable strings so that code to detect special keys can be easier to understand. While these values are not intended to be exposed directly to users, there is nothing preventing that. Apps that choose to expose these values would need to determine whether or not it is appropriate to translate these strings for presentation (e.g.: presenting "Backspace" as "Suppr. arrière" for French users).
5. I18n
The short I18n checklist has been completed and none of the items apply.
6. Security Considerations
The Security and Privacy Self-Review Questionairre has been completed with the following notes:
-
2.1 What information might this feature expose to Web sites or other parties, and for what purposes is that exposure necessary?: This spec defines a set of valid values for the
key
attribute of the various key events. This is necessary so that users can type text. -
2.17 How does your feature handle non-"fully active" documents?: This attribute is only associated with key events, and events are not sent if the document is not fully active.
Security concerns associated with the key
attribute are addressed in the [UIEvents] specification.
7. Privacy Considerations
The Security and Privacy Self-Review Questionairre has been completed with the following notes:
-
2.6 Do the features in your specification expose information about the underlying platform to origins?: The
key
attribute contains the value of the key that is pressed by the user. This could be used to infer that a user is using a keyboard with a particular locale (or IME) enabled. -
3.5 Legitimate Misuse: A site could capture all keypresses and build a map of the values generated by the keyboard. If the user types enough values (and doesn’t change keyboard), then the site could try to match those values against a database of known keyboard layouts to guess the user’s current keyboard layout. However, that’s a concern for the
key
attribute itself (defined in the [UIEvents] specification) rather than something specific to the values defined in this document
Privacy concerns associated with the key
attribute are addressed in the [UIEvents] specification.
8. Acknowledgements
Over the years, many people contributed to the DOM KeyboardEvent
specifications, including many participants of the DOM Working Group and the
WebApps Working Group. The current set of key
values is
the result of iterating over many proposals and variations during that time.
We especially thank the following participants for their contributions:
Gary Kacmarcik (Google), Masayuki Nakano (Mozilla) and Travis Leithead (Microsoft).