This document provides an overview of the various keyboard layouts andspecifies the KeyboardEvent.code values that should beused for each of the keys. Unlike the key values describedin [UIEvents-key], the code values are based only on thekeys physical location on the keyboard and do not vary based on the userscurrent locale.
This specification was formerly titled DOM Level 3 KeyboardEvent code Values.
This specification uses the following conventions:
This section is non-normative.
Alphanumeric keyboards are the most common way for users to generatekeyboard events. This section provides an overview of standard keyboards andtheir physical layouts.
This section describes the physical layouts found on commonly availablekeyboards.
When discussing keyboard layouts, it is convenient to divide thestandard keyboard into distinct sections and to label each row.
These keyboard sections are:
The alphanumeric section is the main part of thekeyboard and is where most of the keyboard variation occurs.When a user selects a keyboard layout, it is the keys in thissections that are most affected.
The control pad and arrow pad sections contain the arrow keys and other editing keys.
The numpad (also known as the "numeric keypad"or "number pad") contains number and math keys to make it easierto enter numeric data.
And finally, the function section containsmiscellaneous function keys and special keys like Escape.
To make it easier to identify keys, the rows on the keyboard arenamed starting with "A" for the bottom row up to "E" for the toprow. The row of keys in the function section are considered to be inrow "K". These row names are consistent with those given in [ISO9995-1].
Note that many keyboards (both modern and legacy) have extra keysthat do not fit neatly into the above sections. Some of these keysare covered in 3.1.6 Media Keys.
The standard "101" keyboard (commonly referred to as the "USlayout") is the only layout that has a "Backslash" key (labeled |) above a single-row Enter key. All the otherlayouts omit this key and expand the Enter key tooccupy two-rows.
Modern standard "101"-layout keyboards actually contain 104 keys: 61keys 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 thetime when this standard keyboard did in fact contain 101 keys. Thetwo Meta keys (commonly given an OS-specific label), and the Menu key were added later to bring the total to 104 keys.
The alternate "101" keyboard has a large Enter key andshrinks the Backspace key to make room for the "IntlYen" key (which replaces the "Backslash" key found in the standard101 layout). The "IntlYen" name comes from the Japanese layoutwhere this is the (yen) key in the Russianlayout shown below this key maps to a /.
Modern alternate "101"-layout keyboards contain 104 keys: 61 keys inthe alphanumeric section and 43 keys in the numpad, control pad, arrow pad and function sections.
The standard "102" keyboard is common throughout Europe and adds akey that doesnt exist on the "101" layouts: The "IntlBackslash" key (labelled | on a UK keyboard) next to the left shiftkey.
A second key is also added (labelled #~ on a UKkeyboard) 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 #~ areactually two separate keys (named "Keyboard and |" and "KeyboardNon-US # and ~"), but since these two keys never co-occur on thesame keyboard most platforms use the same scancode for both keys,making them difficult to distinguish. It is for this reason that thecode "Backslash" is used for both of these keys.
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.
The Korean "103" keyboard is based on the alternate 101 layout andadds two additional keys (one on each side of the spacebar) tohandle Korean-specific input modes. These keys are "Lang2" ("Hanja", labelled hanja)and "Lang1" ("HangulMode", labelled / han/yeong).
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.
The "104" layout used in Brazil adds 4 new keys: two keysfrom the "102" layout ("Backslash" and "IntlBackslash") plusthe "IntlRo" key (next to the right shift key) and an extra keyon the numpad. This new numpad key is called "NumpadComma" because it represents the thousands separator. Onthe Brazilian key layout, this key is labelled . and the "NumpadDecimal" key is labelled ,.
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 haveonly 106 keys.
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).
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.
In general, Apple keyboards follow the same layout as PC keyboards,but there are some differences as noted in the following figure.
In this figure, the green keys are those that have been moved to anew location while the blue keys indicate keys that have been added.
The limited space available on laptop keyboards often means that thephysical key layout needs to be adjusted to fit all the requiredkeys. The writing system keys in the alphanumericsection tend to remain intact, but the other keyboard sectionsare usually combined with other keys or removed altogether.
In this Apple laptop keyboard, the right control key has beenremoved to make room for half-height arrow keys and a Fn keyis added on the left.
PC laptop keyboards vary considerably, but this sample keyboarddemonstrates 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 isoften shrunk to make room for the up arrow key and the right Meta key is typically removed altogether.
In the case where a content author wishes to rely on the mechanicallayout of a mobile keypad, this specification suggests the keyboardconfiguration specified in [ISO9995-8], which defines a numeric keypadlayout 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 someinternational uses.
This keypad layout, and in particular the distribution of letters is forEnglish devices, and will not match the keypads or configurations ofmany users. Content authors cannot rely upon any particularconfiguration, and are expected to create content in aninternationalized and localizable manner.
Many keyboards contain special keys to control media functions.Increasingly, many media devices, especially televisions, areWeb-enabled. Hybrid keyboard/remote-control devices are becoming morecommon. To meet the needs of these hybrid Web/media devices, thisspecification defines keys that are common as remote control buttons, inaddition to traditional keyboard keys.
Because of the smaller form factor, keys (or buttons) on a remotecontrol will often be modal, with one key performing different functionsbased on the context of the on-screen content. Additionally, many keysserve as toggles, to change back and forth between two or more states(see toggling keys). These remote control buttons typically do not havemodifier states so each button is assigned a single function (like Play, Pause, Up, Menu or Exit).
Virtual keyboards are software-based sets of keys, in a variety ofdifferent arrangements, commonly found on touch-screen devices. They areoften modal, with the ability to switch between different dynamic setsof keys, such as alphabetic, numeric, or symbolic keys. Because of thelack of physical constraints, these keyboards MAY present the widestrange of characters, including emoticons and other symbols. Wherever possible,however, virtual keyboards SHOULD produce the normal range of keyboard eventsand values, for ease of authoring and compatibility with existing content.
Chording keyboards, also known as chorded keysets or chord keyboards, arekey input devices which produce values by pressing several keys incombination or sequence, normally to simulate a full range of charactersor commands on a reduced set of keys, often for single-handed use.Achording keyboard MAY have additional mode keys to switch between keyvalues, and the number and type of keys pressed to produce a key valuewill vary, but the final key values produced by such keyboards SHOULDmatch 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.
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 thespecification.
A conforming implementation of the KeyboardEvent interface MUST supportthis set of values for use in the code attributes,although not all values MAY be available on all platforms or devices.
This section defines a list of code values whichimplementations MUST support.
Future versions of this specification MAY include code values not includedhere, 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 befiled so that this specification can be updated.
This section describes the various keyboard sections in more detail anddefines the code values that should be used for eachkey.
The alphanumeric section is the main section of the keyboard. Itcontains keys that fall into two generalcategories: writing system keys whose meaningchanges based on the current keyboard layout, and functional keys which are (mostly) the same for alllayouts.
The writing system keys are those that changemeaning (i.e., they produce different key values) based on the current locale and keyboard layout.
This figure shows a hypothetical keyboard that combines all the writing system keys (shown in blue and green) found on thevarious keyboards. Blue keys are present on all standardkeyboards while green keys are only available on some keyboards.
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 USkey in that position (i.e., they are based on the US keyboardlayout). For keys that dont exist on the US keyboard, namesfrom the UK or Japanese layouts are used instead.
Note that there are two "Backslash" keys in this figure: alarge one at the end of Row D on the 101-key layout, and asmaller one between "Quote" and "Enter" on Row C of the102-, 104- and 106-key layouts. Only one "Backslash" keymay be present on a keyboard layout.
The functional keys (not to be confused with the function keys described later) are those keys in the alphanumeric section that provide general editingfunctions that are common to all locales (like Shift, Tab, Enter and Backspace). With a fewexceptions, these keys do not change meaning based on thecurrent keyboard layout.
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 itproduces "Alt" while in others it produces "AltGraph".
On some keyboards (notably Japanese and Korean) the spacebar isreduced in size to make room for extra keys on the bottom row (Row A).These keys typically allow the users to change the current inputmode. Note that even though some of these Japanese and Koreankeys occupy the same physical location on the keyboard, they usedifferent code values.
On Apple keyboards, some keys on the bottom row are omitted andothers are arranged in a different order.
The control pad section of the keyboard is the set of (usually 6) keysthat perform navigating and editing operations, for example, Home, PageUp and Insert.
The code for the Fn key (found on someApple keyboards) is defined below in the function section.
The arrow pad contains the 4 arrow keys. The keys are commonlyarranged in an "upside-down T" configuration.
The numpad section is the set of keys on the keyboard arranged ina grid like a calculator or mobile phone. This section contains numeric andmathematical operator keys. Often this section will contain a NumLock key which causes the keys to switch between the standard numeric functionsand mimicking the keys of the control pad and arrow pad.Laptop computers and compact keyboards will commonly omit thesekeys to save space.
A keypad is an alternate term for numpad.
The code values in this section should also beused for phone keypads and remote control devices thatarrange number keys in a grid.
The standard numpad is sometimes extended with additional keys forparentheses, operators, hexadecimal symbols, or calculator functions(like Backspace). Some of the commonly added keys are listedin the table below.
For numpads that provide keys not listed here, a code value string should be created by startingwith "Numpad" and appending an appropriate description of the key.
The function section runs along the top of the keyboard (abovethe alphanumeric section) andcontains 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 functionor action.
On some keyboards (especially those found on laptops or otherportable computers), the function keys (F1 ... F12) are defined to have other primary functions (likecontrolling display brightness or audio volume) and require that aseparate Fn key be pressed to make them act as functionkeys. Unfortunately, the primary functions assigned to these keysvaries widely from one manufacturer to the next. Because of this,the code is always set to the function key name.
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 thesekeys are defined in 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 nothave a standard location on the keyboard so keyboards from differentmanufacturers are likely to have a different arrangement of keys or acompletely different sets of keys.
Media keys are often distinct fromnormal typing keys in appearance and may be recessed in thekeyboard.
On laptop keyboards, these keys are often merged with the function keys, with the media key interpretation beingthe primary function of the key and the function key interpretation requiring the Fn key to be pressed at thesame time. In this configuration the code shouldbe 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.
These keys are not found on modern standard keyboards. They arelisted here for reference purposes.
The following keys may be found on non-standard international keyboards.
And finally, the following code value should onlybe 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 nothave their keys arranged in a way that corresponds to those on aphysical keyboard.
Conforming implementations MUST only use "Unidentified" as a key codewhen there is no way for the implementation to determine the key code.Exposing only this value MUST NOT indicate a conforming implementation.
Considerable thanks are due to the following participants of the WebAppsWorking Group for providing substantial material contributions in theprocess of developing this specification.
Gary Kacmarcik (Google),Masayuki Nakano (Mozilla)
See the original post here:
- Everything Paradox Interactive Announced At PDXCON 2019 - Kotaku Australia - October 24th, 2019
- Netflix vows crackdown on users who share logins with pals or family and could make you pay EXTRA - The Sun - October 24th, 2019
- Dont like the facts? Just Schiff the narrative - Boston Herald - October 1st, 2019
- Automate the Boring Stuff with Python - June 3rd, 2019
- AltLeft.com "The Left of the AltRight" - May 2nd, 2019
- Andrew Yang Rejects Support From White Nationalists ... - May 1st, 2019
- Ripple Price Forecast: XRP vs SWIFT, SEC Updates, and More - April 29th, 2019
- Cryptocurrency News: Looking Past the Bithumb Crypto Hack - April 29th, 2019
- Cryptocurrency News: This Week on Bitfinex, Tether, Coinbase, & More - April 29th, 2019
- Cryptocurrency News: What You Need to Know This Week - April 29th, 2019
- Cryptocurrency News: XRP Validators, Malta, and Practical Tokens - April 29th, 2019
- Cryptocurrency News: Bitcoin ETFs, Andreessen Horowitz, and Contradictions in Crypto - April 29th, 2019
- Cryptocurrency News: New Exchanges Could Boost Crypto Liquidity - April 29th, 2019
- Cryptocurrency News: Bitcoin ETF Rejection, AMD Microchip Sales, and Hedge Funds - April 29th, 2019
- Bitcoin Rise: Is the Recent Bitcoin Price Surge a Sign of Things to Come or Another Misdirection? - April 29th, 2019
- Cryptocurrency News: Vitalik Buterin Doesn’t Care About Bitcoin ETFs - April 29th, 2019
- Lionel Nation - YouTube - April 22nd, 2019
- The Politically Incorrect Australian - April 22nd, 2019
- Some People Are Exceptionally Good at Predicting the Future - April 12th, 2019
- Scientists Say New Quantum Material Could “‘Download’ Your Brain” - April 12th, 2019
- Scientists Find a New Way to Kickstart Stable Fusion Reactions - April 12th, 2019
- The Israeli Moon Lander Is About to Touch Down - April 12th, 2019
- MIT Prof: If We Live in a Simulation, Are We Players or NPCs? - April 12th, 2019
- Here’s How Big the M87 Black Hole Is Compared to the Earth - April 12th, 2019
- Amazon Workers Listen to Your Alexa Conversations, Then Mock Them - April 12th, 2019
- NASA Is Funding the Development of 18 Bizarre New Projects - April 12th, 2019
- Report: Tesla Doc Is Playing Down Injuries to Block Workers’ Comp - April 12th, 2019
- Infertile Couple Gives Birth to “Three-Parent Baby” - April 12th, 2019
- NASA: Genetic Changes Caused by Space Travel Are Temporary - April 12th, 2019
- Israel’s Lunar Lander Just Crashed Into the Moon - April 12th, 2019
- We Wouldn’t Have the First Black Hole Image Without Katie Bouman - April 12th, 2019
- Family Caught Selling Diseased Body Parts to Medical Centers - April 12th, 2019
- SpaceX Milestone: Company Lands Three Falcon Heavy Boosters - April 12th, 2019
- Space Station Mice Learned to Propel Themselves in Zero Gravity - April 12th, 2019
- People Are Horrified When They Have to Torture a Virtual Person - April 12th, 2019
- Fecal Transplants Reduce Symptoms of Autism Long Term - April 12th, 2019
- The First Black Hole Photo Is Even More Amazing When You Zoom Out - April 12th, 2019
- Seven Ways Cannabis Legalization Will Make the Future Better - April 11th, 2019
- Chinese Scientists Gene-Hacked Super Smart Human-Monkey Hybrids - April 11th, 2019
- Scientists: Next Black Hole Image Will Be Way Clearer - April 11th, 2019
- Walmart Is Rolling Out Floor-Cleaning Robots in 1,500 Stores - April 11th, 2019
- Zapping Elderly People’s Brains Supercharges Their Working Memory - April 11th, 2019
- Tesla Says Autopilot Is Statistically Safer Than a Human Driver - April 11th, 2019
- Amazon Is Fighting South American Govs to Control “.Amazon” Domains - April 11th, 2019
- China Is Trying to Scrub Bikinis and Smoking From the Internet - April 11th, 2019
- Undersea Robots Are Helping Save the Great Barrier Reef - April 11th, 2019
- The Israeli Moon Lander Is About to Touch Down - April 11th, 2019
- Some People Are Exceptionally Good at Predicting the Future - April 11th, 2019
- Scientists Find a New Way to Kickstart Stable Fusion Reactions - April 11th, 2019
- Amazon Workers Listen to Your Alexa Conversations, Then Mock Them - April 11th, 2019
- Scientists Say New Quantum Material Could “‘Download’ Your Brain” - April 11th, 2019
- Infertile Couple Gives Birth to “Three-Parent Baby” - April 11th, 2019
- MIT Prof: If We Live in a Simulation, Are We Players or NPCs? - April 11th, 2019
- Here’s How Big the M87 Black Hole Is Compared to the Earth - April 11th, 2019
- NASA Is Funding the Development of 18 Bizarre New Projects - April 11th, 2019
- Report: Tesla Doc Is Playing Down Injuries to Block Workers’ Comp - April 11th, 2019
- Special Announcement: Futurism Media and Singularity University - March 16th, 2019
- Just 19 Percent of Americans Trust Self-Driving Cars With Kids - March 16th, 2019
- Elon Musk: $47,000 Model Y SUV “Will Ride Like a Sports Car” - March 16th, 2019
- Elon Musk: 2019 Will Be “the Year of the Solar Roof” - March 16th, 2019
- This Guy Spent a Whole Week In a VR Headset - March 16th, 2019
- How Can We Build Cities to Accommodate 6.5 Billion People? - March 16th, 2019
- Samsung Is Working on Phone With “Invisible” Camera Behind Screen - March 16th, 2019
- This Tech Could Secure Medical Implants Against Hackers - March 16th, 2019
- Here’s How Hackers Stole $15 Million From Mexican Banks - March 16th, 2019
- Slack Just Removed a Bunch of Hate Groups - March 16th, 2019
- Presidential Hopeful Beto O’Rourke Belonged to Infamous Hacker Group - March 16th, 2019
- New Rocket Engine Could Whip You From London to Sydney in 4 Hours - March 16th, 2019
- NASA: Space Travel Is Causing Astronauts’ Herpes to Flare Up - March 16th, 2019
- New Robot Hand Works Like a Venus Flytrap to Grip Objects - March 16th, 2019
- States Are Approving Cannabis to Fight Opioid Addiction - March 16th, 2019
- Astronomers Just Found 83 Giant Black Holes at Universe’s Edge - March 16th, 2019
- The Pentagon Wants an Orbital Space Weapon to Blast Enemy Missiles - March 16th, 2019
- Computer Fraud Laws are Flawed, this Lawyer is Fighting Against Them - March 16th, 2019
- NASA Engineer: Humans Should Consider Settling Saturn’s Moon Titan - March 16th, 2019
- Cryptocurrency Price Forecast: Trust Is Growing, But Prices Are Falling - March 14th, 2019
- Cryptocurrency News: This Week on Bitfinex, Tether, Coinbase, & More - March 14th, 2019
- Ripple Price Forecast: XRP vs SWIFT, SEC Updates, and More - March 14th, 2019
- Cryptocurrency News: XRP Validators, Malta, and Practical Tokens - March 14th, 2019
- Cryptocurrency News: Bitcoin ETFs, Andreessen Horowitz, and Contradictions in Crypto - March 14th, 2019