This specification defines the values for the KeyboardEvent.key attribute, which is defined as part of the Document Object Model (DOM) Level 3 Events Specification [DOM3 Events]. The key attribute contains information about the character generated by the key event.

This document is a Working Draft of the DOM Level 3 KeyboardEvent key Values specification. It is expected that this specification will progress to W3C Recommendation status after review and refinement.

This document is produced by the Web Applications WG, part of the Rich Web Clients Activity in the W3C Interaction Domain. It is expected that this document will progress along the W3C's Recommendation track. 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.

You can find the latest Editor's Draft of this document in the W3C's Mercurial repository, which is updated on a regular basis.

Implementers should be aware that this document is not stable. Implementers who are not taking part in the discussions are likely to find the specification changing out from under them in incompatible ways. Vendors interested in implementing this document before it eventually reaches the Candidate Recommendation stage should join the aforementioned mailing lists and take part in the discussions.

Keyboard Event key Value Tables

This section defines a list of key values which implementations MUST support, at a minimum, in addition to support for the full range of Unicode [Unicode] codepoints. The KeyboardEvent.key attribute of an event MUST always contain one of these control key or character values (even if the value is 'Unidentified'). If the key represents one of the set of printable control characters which has a Unicode character entry, such as the tab key, the KeyboardEvent.key attribute MUST have the key value (e.g., 'Tab').

Implementations that are unable to identify a key MUST use the key value 'Unidentified'.

Warning! 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 MUST NOT indicate a conforming implementation.

The key values defined in this specification 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 [KeyEvent for Java], and the System.Windows.Forms.Keys key enumeration of the Microsoft .NET Framework 4.0 Class Library [Keys enumeration for .Net].

Note: The keys on the numeric keypad (e.g., the keypad '1' key) do not generate distinct key values from their non-keypad counterparts (e.g., the '1' key in the main part of the keyboard). The KeyboardEvent.location attribute can be used to determine if a key originated from the numeric keypad.

Note: There are special internationalization considerations for ECMAScript escaped characters. CharMod conformance [CharMod] expects the use of code points rather than surrogate pairs in escapes. ECMAScript escaped characters use surrogate pairs for characters outside the Basic Multilingual Plane ("\uD84E\uDDC2" for '𣧂', a Chinese character meaning untidy), rather than C-style fixed-length characters ("\U000239c2" for '𣧂') or delimited escapes such as Numeric Character References ("𣧂"). Characters escaped in this manner:

The following sub-sections contain the normative list of case-sensitive key values, their character values (where applicable), an informative description of typical usage, and an informative categorization. A conforming implementation of the KeyboardEvent interface MUST support at least this set of values for use in the KeyboardEvent.key attributes, though 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.

Special Key Values

This key value is used when an implementation is unable to identify another key value, due to either hardware, platform, or software constraints.

Modifier Keys

This is a virtual modifier key that is equivalent to whichever key the current OS uses as the menu "accelerator" key. This virtual modifier key is never set returned in a key event, and is only valid for use with the KeyboardEvent.getModifierState() method. This virtual key is always set in conjunction with one of the other modifier keys in this list.

For Windows, this virtual key is equivalent to the 'Control' key.

For Mac OS, this key is typically equivalent to the 'Meta' key. Although note that the 'Meta' key on other platforms is not necessarily associated with the 'Accel'.

The Alternative (Alt, Option, Menu) key. Enable alternate modifier function for interpreting concurrent or subsequent keyboard input. This key value is also used for the Apple 'Option' key. 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). The Caps Lock (Capital) key. Toggle capital character lock function for interpreting subsequent keyboard input event. The Control (Ctrl) key, to enable control modifier function for interpreting concurrent or subsequent keyboard input. 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. The Function-Lock (FnLock, 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. The Hyper key. The Meta key, to enable meta modifier function for interpreting concurrent or subsequent keyboard input. This key value is also used for the Apple 'Command' ('⌘') key. The Number Lock key, to toggle numer-pad mode function for interpreting subsequent keyboard input. The operating system key (e.g. the Windows Logo key). The Scroll Lock key, to toggle between scrolling and cursor movement modes. The Shift key, to enable shift modifier function for interpreting concurrent or subsequent keyboard input. The Super key. The Symbol modifier key (used on some virtual keyboards). The Symbol Lock key.

Whitespace Keys

The Enter key, to activate current selection or accept current input. This key value is also used for the 'Return' (Macintosh numpad) key. The Separator key, for context-sensitive text separators. The Horizontal Tabulation (Tab) key.

Note: The space or spacebar key is encoded as ' '.

Navigation Keys

The down arrow key, to navigate or traverse downward. The left arrow key, to navigate or traverse leftward. The right arrow key, to navigate or traverse rightward. The up arrow key, to navigate or traverse upward. The End key, used with keyboard entry to go to the end of content. The Home key, used with keyboard entry, to go to start of content. The Page Down key, to scroll down or display next page of content. The Page Up key, to scroll up or display previous page of content.

Editing Keys

The Backspace key. This key value is also used for the key labeled 'delete' on MacOS keyboards. The Clear key, for removing current selected input. The Copy key. The Cursor Select (Crsel) key. The Cut key. The Delete (Del) Key. This key value is also used for the key labeled 'delete' on MacOS keyboards when modified by the 'Fn' key. The Erase to End of Field key. This key deletes all characters from the current cursor position to the end of the current field. The Extend Selection (Exsel) key. The Insert (Ins) key, to toggle between text modes for insertion or overtyping. The Paste key. The Redo key. The Undo key.

UI Keys

The Accept (Commit, OK) key. Accept current option or input method sequence conversion. The Again key, to redo or repeat an action. The Attention (Attn) key. The Cancel key. Show the application's context menu. This key is commonly found between the right 'OS' key and the right 'Control' key. The Escape (Esc) key, to initiate an escape sequence. The Execute key. The Find key. Toggle display of help information. Pause the current state or application (as appropriate).

Note: Do not use this value for the pause button on media controllers. Use 'MediaPause' instead.

Play or resume the current state or application (as appropriate).

Note: Do not use this value for the play button on media controllers. Use 'MediaPlay' instead.

The properties (Props) key. The Select key. The ZoomIn key. The ZoomOut key.

Device Keys

The Brightness Down key. Typically controls the display brightness. The Brightness Up key. Typically controls the display brightness. The Camera key. Toggle removable media to eject (open) and insert (close) state. The LogOff key. Toggle power state.

Note: Some devices might not expose this key to the operating environment.

The PowerOff key. Sometime called "PowerDown". The Print Screen (PrintScrn, SnapShot) key, to initiate print-screen function. 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. 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 called the "Suspend" or "Sleep" key. The WakeUp key.

IME and Composition Keys

The All Candidates key, to initate the multi-candidate mode. The Alphanumeric key. The Code Input key, to initiate the Code Input mode to allow characters to be entered by their code points. 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. The Convert key, to convert the current input method sequence. 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 '\u0302' 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. The Final Mode (Final) key used on some Asian keyboards, to enable the final mode for IMEs. Switch to the first character group. (ISO/IEC 9995) Switch to the last character group. (ISO/IEC 9995) Switch to the next character group. (ISO/IEC 9995) Switch to the previous character group. (ISO/IEC 9995) The Mode Change key, to toggle between or cycle through input modes of IMEs. The Next Candidate function key. The NonConvert (Don't Convert) key, to accept current input method sequence without conversion in IMEs. The Previous Candidate function key. The Process key. The Single Candidate function key.

Keys specific to Korean keyboards

The Hangul (Korean characters) Mode key, to toggle between Hangul and English modes. The Hanja (Korean characters) Mode key. The Junja (Korean characters) Mode key.

Keys specific to Japanese keyboards

The Eisu key. This key may close the IME, but it's purpose is defined by the current IME. The (Half-Width) Characters key. The Hiragana (Japanese Kana characters) key. The Hiragana/Katakana toggle key. The Kana Mode (Kana Lock) key. The Kanji (Japanese name for ideographic characters of Chinese origin) Mode key. The Katakana (Japanese Kana characters) key. The Roman characters function key. The Zenkaku (Full-Width) Characters key. The Zenkaku/Hankaku (full-width/half-width) toggle key.

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.

The F1 key, a general purpose function key, as index 1. The F2 key, a general purpose function key, as index 2. The F3 key, a general purpose function key, as index 3. The F4 key, a general purpose function key, as index 4. The F5 key, a general purpose function key, as index 5. The F6 key, a general purpose function key, as index 6. The F7 key, a general purpose function key, as index 7. The F8 key, a general purpose function key, as index 8. The F9 key, a general purpose function key, as index 9. The F10 key, a general purpose function key, as index 10. The F11 key, a general purpose function key, as index 11. The F12 key, a general purpose function key, as index 12. General purpose virtual function key, as index 1. General purpose virtual function key, as index 2. General purpose virtual function key, as index 3. General purpose virtual function key, as index 4.

Multimedia Keys

These are extra keys found on "multimedia" keyboards.

Close the current document or message. Open an editor to forward the current message. Open an editor to reply to the current message. Send the current message. Toggle media between play and pause states. Select media. Stop media playing, pausing, forwarding, rewinding, or recording, if not already stopped. Seek to next media or program track. Seek to previous media or program track. Open a new document or message. Open an existing document or message. Print the current document or message. Save the current document or message. Spellcheck the current document or selection. Decrease audio volume. Increase audio volume. Toggle between muted state and prior volume level.

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.

The 'Calculator' key. This is often the generic 'LaunchApplication' key, as index 2. The 'Calendar' key. The 'Mail' key. The 'Media Player' key. The 'Music Player' key. The 'My Computer' key. This is often the generic 'LaunchApplication' key, as index 1. The 'Screen Saver' key. The 'Spreadsheet' key. The 'Web Browser' key. The 'WebCam' key. The 'Word Processor' key.

Browser Keys

Navigate to previous content or page in current history. The Browser Favorites key. Navigate to next content or page in current history. The Browser Home key, used with keyboard entry, to go to the home page. The Browser Refresh key, to refresh the current page or content. The Browser Search key, to call up the user's preferred search page. The Browser Stop key, to stop loading the current page or content.

Media Controller Keys

The key 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:

Adjust audio balance leftward. (VK_AUDIO_BALANCE_LEFT) Adjust audio balance rightward. (VK_AUDIO_BALANCE_RIGHT) Decrease audio bass boost or cycle down through bass boost states. (VK_BASS_BOOST_DOWN) Increase audio bass boost or cycle up through bass boost states. (VK_BASS_BOOST_UP) Adjust audio fader towards front. (VK_FADER_FRONT) Adjust audio fader towards rear. (VK_FADER_REAR) Advance surround audio mode to next available mode. (VK_SURROUND_MODE_NEXT) Switch the input mode on an external AVR (audio/video receiver). Toggle the power on an external AVR (audio/video receiver). Select next (numerically or logically) lower channel. (VK_CHANNEL_DOWN) Select next (numerically or logically) higher channel. (VK_CHANNEL_UP) General purpose color-coded media function key, as index 0 (red). (VK_COLORED_KEY_0) General purpose color-coded media function key, as index 1 (green). (VK_COLORED_KEY_1) General purpose color-coded media function key, as index 2 (yellow). (VK_COLORED_KEY_2) General purpose color-coded media function key, as index 3 (blue). (VK_COLORED_KEY_3) General purpose color-coded media function key, as index 4 (grey). (VK_COLORED_KEY_4) General purpose color-coded media function key, as index 5 (brown). (VK_COLORED_KEY_5) Toggle the display of Closed Captions. (VK_CC) Adjust brightness of device, by toggling between or cycling through states. (VK_DIMMER) Swap video sources. (VK_DISPLAY_SWAP) Exit the current application. (VK_EXIT) Clear program or content stored as favorite 0. (VK_CLEAR_FAVORITE_0) Clear program or content stored as favorite 1. (VK_CLEAR_FAVORITE_1) Clear program or content stored as favorite 2. (VK_CLEAR_FAVORITE_2) Clear program or content stored as favorite 3. (VK_CLEAR_FAVORITE_3) Select (recall) program or content stored as favorite 0. (VK_RECALL_FAVORITE_0) Select (recall) program or content stored as favorite 1. (VK_RECALL_FAVORITE_1) Select (recall) program or content stored as favorite 2. (VK_RECALL_FAVORITE_2) Select (recall) program or content stored as favorite 3. (VK_RECALL_FAVORITE_3) Store current program or content as favorite 0. (VK_STORE_FAVORITE_0) Store current program or content as favorite 1. (VK_STORE_FAVORITE_1) Store current program or content as favorite 2. (VK_STORE_FAVORITE_2) Store current program or content as favorite 3. (VK_STORE_FAVORITE_3) Toggle display of program or content guide. (VK_GUIDE) If guide is active and displayed, then display next day's content. (VK_NEXT_DAY) If guide is active and displayed, then display previous day's content. (VK_PREV_DAY) Toggle display of information about currently selected context or media. (VK_INFO) Toggle instant replay. (VK_INSTANT_REPLAY) Launch linked content, if available and appropriate. (VK_LINK) List the current program. (VK_LIST) Toggle display listing of currently available live content or programs. (VK_LIVE) Lock or unlock current content or program. (VK_LOCK) Show a list of media applications. (VK_APPS)

Note: Do not confuse this key value with the Windows' VK_APPS / VK_CONTEXT_MENU key, which is encoded as 'ContextMenu'.

Initiate or continue forward playback at faster than normal speed, or increase speed if already fast forwarding. (VK_FAST_FWD) Select previously selected channel or media. (VK_LAST) Pause the currently playing media. (VK_PAUSE)

Note: Media controller devices should use this value rather than 'Pause' for their pause keys.

Initiate or continue media playback at normal speed, if not currently playing at normal speed. (VK_PLAY) Initiate or resume recording of currently selected media. (VK_RECORD) Initiate or continue reverse playback at faster than normal speed, or increase speed if already rewinding. (VK_REWIND) Skip forward to next content or program. (VK_SKIP) Cycle to next favorite channel (in favorites list). (VK_NEXT_FAVORITE_CHANNEL) Cycle to next user profile (if there are multiple user profiles). (VK_USER) Access on-demand content or programs. (VK_ON_DEMAND) Move picture-in-picture window down. (VK_PINP_DOWN) Move picture-in-picture window. (VK_PINP_MOVE) Toggle display of picture-in-picture window. (VK_PINP_TOGGLE) Move picture-in-picture window up. (VK_PINP_UP) Decrease media playback speed. (VK_PLAY_SPEED_DOWN) Reset playback to normal speed. (VK_PLAY_SPEED_RESET) Increase media playback speed. (VK_PLAY_SPEED_UP) Toggle random media or content shuffle mode. (VK_RANDOM_TOGGLE) Not a physical key, but this key code is sent when the remote control battery is low. (VK_RC_LOW_BATTERY) Toggle or cycle between media recording speeds. (VK_RECORD_SPEED_NEXT) Toggle RF (radio frequency) input bypass mode (pass RF input directly to the RF output). (VK_RF_BYPASS) Toggle scan channels mode. (VK_SCAN_CHANNELS_TOGGLE) Advance display screen mode to next available mode. (VK_SCREEN_MODE_NEXT) Toggle display of device settings screen. (VK_SETTINGS) Toggle split screen mode. (VK_SPLIT_SCREEN_TOGGLE) Switch the input mode on an external STB (set top box). Toggle the power on an external STB (set top box). Toggle display of subtitles, if available. (VK_SUBTITLE) Toggle display of teletext, if available (VK_TELETEXT). Switch to viewing TV. Switch the input mode on an external TV. Toggle the power on an external TV. Advance video mode to next available mode.(VK_VIDEO_MODE_NEXT) Cause device to identify itself in some manner, e.g., audibly or visibly. (VK_WINK) Toggle between full-screen and scaled content, or alter magnification level. (VK_ZOOM)

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:

Navigate to previous content or page in current history. (VK_BACK) Navigate to next content or page in current history. (VK_FORWARD) Toggle display of the on-screen menu. (VK_MENU) Toggle removable media to eject (open) and insert (close) state. (VK_EJECT_TOGGLE) The End key, used with keyboard entry to go to the end of content. (VK_GO_TO_END) The Enter key, to activate current selection or accept current input. (VK_SELECT) The Home key, used with keyboard entry, to go to start of content. (VK_GO_TO_START) Toggle media between play and pause states. (VK_PLAY_PAUSE) Stop media playing, pausing, forwarding, rewinding, or recording, if not already stopped. (VK_STOP) Seek to next media or program track. (VK_TRACK_NEXT) Seek to previous media or program track. (VK_TRACK_PREV) Toggle power state. (VK_POWER) 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) Decrease audio volume. (VK_VOLUME_DOWN) Increase audio volume. (VK_VOLUME_UP) Toggle between muted state and prior volume level. (VK_VOLUME_MUTE)

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).

References

For the latest version of any W3C specification please consult the list of W3C Technical Reports available at http://www.w3.org/TR/.

Normative References

[CharMod]
Character Model for the World Wide Web 1.0: Fundamentals,
M. Dürst, F. Yergeau, R. Ishida, M. Wolf, T. Texin, Editors.
World Wide Web Consortium, 15 February 2005.
This version of the Character Model for the World Wide Web 1.0: Fundamentals specification is http://www.w3.org/TR/2005/REC-charmod-20050215/.
The latest version of Character Model for the World Wide Web 1.0: Fundamentals is available at http://www.w3.org/TR/charmod/.
[DOM3 Events]
Document Object Model (DOM) Level 3 Events Specification,
G. Kacmarcik, T. Leithead, Editors.
World Wide Web Consortium, April 2014.
This version of the Document Object Model Level 3 Events Specification is https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html.
The latest version of Document Object Model Level 3 Events is available at http://www.w3.org/TR/DOM-Level-3-Events/.
[Unicode]
The Unicode Standard, Version 5.0,
ISBN 0-321-48091-0, as updated periodically by the publication of new versions.
See also Versions of the Unicode Standard, available at http://www.unicode.org/standard/versions/ for latest version and additional information on versions of the standard and of the Unicode Character Database.

Informative References

[DASE]
ATSC A/100-2, DTV Application Software Environment Level 1 (DASE-1) Part 2: Declarative Applications and Environment.
Advanced Television Systems Committee, 09 March 2003.
Available at http://www.atsc.org/cms/standards/a100/a_100_2.pdf.
[KeyEvent for Java]
Java™ Platform, Standard Edition 6 API Specification, Class java.awt.events.KeyEvent.
Oracle.
Available at http://docs.oracle.com/javase/6/docs/api/java/awt/event/KeyEvent.html.
[Keys Enumeration for .Net]
.NET Framework 4.5 Class Library, Keys Enumeration.
Microsoft.
Available at http://msdn.microsoft.com/en-us/library/system.windows.forms.keys.aspx.
[OCAP]
Open Cable Application Platform 1.1.3.
Cable Television Laboratories, Inc.,
03 June 2010.
Available at http://www.cablelabs.com/specifications/OC-SP-OCAP1.1.3-100603.pdf.
[WEB4CE]
ANSI/CEA-2014-B, Web-based Protocol and Framework for Remote User Interface on UPnPTM Networks and the Internet (Web4CE).
Consumer Electronics Association, January 2011.
Available at http://www.ce.org/Standards/Standard-Listings/R7-Home-Network-Committee/CEA-2014-B-(ANSI%29.aspx.