KeyboardEvent

This article is in need of a technical review.

KeyboardEvent objects describe a user interaction with the keyboard. Each event describes a key; the event type (keydown, keypress, or keyup) identifies what kind of activity was performed.

Note: The KeyboardEvent indicates just what's happening on a key. When you need to handle text input, use HTML5 input event instead. For example, if user inputs text from hand-writing system like tablet PC, key events may not be fired.

Method overview

boolean getModifierState(in DOMString keyArg);
void initKeyboardEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in views::AbstractView viewArg, in DOMString charArg, in DOMString keyArg, in unsigned long locationArg, in DOMString modifiersListArg, in boolean repeat);

Attributes

Attribute Type Description
altKey boolean true if the Alt (or Option, on Mac) key was active when the key event was generated. Read only.
char DOMString

The character value of the key. If the key corresponds to a printable character, this value is a non-empty Unicode string containing that character. If the key doesn't have a printable representation, this is an empty string. See key names for the detail. Read only.

Note: If the key is used as a macro that inserts multiple characters, this attribute's value is the entire string, not just the first character.
Warning: This  has been dropped from DOM Level 3 Events. This is supported only on IE.
charCode unsigned long

The Unicode reference number of the key; this attribute is used only by the keypress event. For keys whose char attribute contains multiple characters, this is the Unicode value of the first character in that attribute. In Firefox 26 this returns codes for printable characters. Read only.

Warning: This attribute is deprecated; you should use key instead, if available.
ctrlKey boolean true if the Control key was active when the key event was generated. Read only.
isComposing DOM level 3 boolean true if the event is fired between after compositionstart and before compositionend. Read only.
key DOMString

The key value of the key represented by the event. If the value has a printed representation, this attribute's value is the same as the char attribute. Otherwise, it's one of the key value strings specified in Key values. If the key can't be identified, this is the string "Unidentified". See key names for the detail. In Firefox 26 this has a valid string for non-printable characters, and some printable characters (e.g. Tab, Enter). For regular characters it returns only "MozPrintableKey". charCode works and returns the character code. Read only.

Gecko note: Not yet implemented; see bug 680830.

This attribute is not implemented in Gecko at this time.

keyCode

unsigned long

A system and implementation dependent numerical code identifying the unmodified value of the pressed key. This is usually the decimal ASCII (RFC 20) or Windows 1252 code corresponding to the key; see Virtual key codes for a list of Gecko's keyCode values. If the key can't be identified, this value is 0. Read only.

Warning: This attribute is deprecated; you should use key instead, if available.
locale DOMString

A locale string indicating the locale the keyboard is configured for. This may be the empty string if the browser or device doesn't know the keyboard's locale. Read only.

Note: This does not describe the locale of the data being entered. A user may be using one keyboard layout while typing text in a different language.

location DOM level 3

unsigned long

The location of the key on the keyboard or other input device; see Key location constants below. Read only.

metaKey boolean true if the Meta (or Command, on Mac) key was active when the key event was generated. Read only.
repeat DOM level 3 Requires Gecko 28.0 boolean

true if the key is being held down such that it is automatically repeating. Read only.

shiftKey boolean true if the Shift key was active when the key event was generated. Read only.
which unsigned long

A system and implementation dependent numeric code identifying the unmodified value of the pressed key; this is usually the same as keyCode. Read only.

Warning: This attribute is deprecated; you should use key instead, if available.

Constants

Virtual key codes

Deprecated
This feature has been removed from the Web. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.

These constants represent virtual key codes as reported by the deprecated keyCode attribute; that is, keys that do not correspond to printable characters. The diagram below represents a standard ANSI US keyboard; Mac and most PC keyboards have the same layout for the printable characters, and a similar layout for the remaining keys.

Starting in Gecko 15 (Firefox 15.0 / Thunderbird 15.0 / SeaMonkey 2.12), Gecko decides keycode by following rules for printable keys:

  1. If the system is Windows and native keycode of pressed key indicates that the key is a-z or 0-9, uses a keycode for it.
  2. If the system is Mac and native keycode of pressed key indicates that the key is 0-9, uses a keycode for it.
  3. If pressed key inputs an ASCII alphabet or numeric with no modifier key, uses a keycode for it.
  4. If pressed key inputs an ASCII alphabet or numeric with Shift key, uses a keycode for it.
  5. If pressed key inputs another ASCII character with no modifier key, uses a keycode for it.
  6. If pressed key inputs another ASCII character with Shift key, users a keycode for it.
  7. Otherwise, i.e., pressed key inputs a Unicode character:
    1. If the keyboard layout is ASCII capable keyboard layout (i.e., can input ASCII alphabets), uses 0.
    2. Otherwise, i.e., the keyboard layout isn't ASCII capable, using ASCII capable keyboard layout which is installed on the environment and has highest priority:
      1. If pressed key on the alternative keyboard layout inputs an ASCII alphabet or numeric, uses a keycode for it.
      2. Otherwise, uses 0.
Note: Web developers shouldn't use the keycode attribute for printable characters when handling keydown and keyup events. As described above, the keycode attribute is not useful for printable characters, especially those input with the shift or Alt key pressed. When implementing a shortcut key handler, the keypress event is usually better (at least when Gecko is the runtime in use). See Gecko Keypress Event for details.
Constant Value Description
DOM_VK_CANCEL 0x03 (3) Cancel key.
DOM_VK_HELP 0x06 (6) Help key.
DOM_VK_BACK_SPACE 0x08 (8) Backspace key.
DOM_VK_TAB 0x09 (9) Tab key.
DOM_VK_CLEAR 0x0C (12) "5" key on Numpad when NumLock is unlocked. Or on Mac, clear key which is positioned at NumLock key.
DOM_VK_RETURN 0x0D (13) Return/enter key on the main keyboard.
DOM_VK_ENTER 0x0E (14) Reserved, but not used. Obsolete since Gecko 30 (Dropped, see bug 969247.)
DOM_VK_SHIFT 0x10 (16) Shift key.
DOM_VK_CONTROL 0x11 (17) Control key.
DOM_VK_ALT 0x12 (18) Alt (Option on Mac) key.
DOM_VK_PAUSE 0x13 (19) Pause key.
DOM_VK_CAPS_LOCK 0x14 (20) Caps lock.
DOM_VK_KANA 0x15 (21) Linux support for this keycode was added in Gecko 4.0.
DOM_VK_HANGUL 0x15 (21) Linux support for this keycode was added in Gecko 4.0.
DOM_VK_EISU 0x 16 (22) "英数" key on Japanese Mac keyboard.
DOM_VK_JUNJA 0x17 (23) Linux support for this keycode was added in Gecko 4.0.
DOM_VK_FINAL 0x18 (24) Linux support for this keycode was added in Gecko 4.0.
DOM_VK_HANJA 0x19 (25) Linux support for this keycode was added in Gecko 4.0.
DOM_VK_KANJI 0x19 (25) Linux support for this keycode was added in Gecko 4.0.
DOM_VK_ESCAPE 0x1B (27) Escape key.
DOM_VK_CONVERT 0x1C (28) Linux support for this keycode was added in Gecko 4.0.
DOM_VK_NONCONVERT 0x1D (29) Linux support for this keycode was added in Gecko 4.0.
DOM_VK_ACCEPT 0x1E (30) Linux support for this keycode was added in Gecko 4.0.
DOM_VK_MODECHANGE 0x1F (31) Linux support for this keycode was added in Gecko 4.0.
DOM_VK_SPACE 0x20 (32) Space bar.
DOM_VK_PAGE_UP 0x21 (33) Page Up key.
DOM_VK_PAGE_DOWN 0x22 (34) Page Down key.
DOM_VK_END 0x23 (35) End key.
DOM_VK_HOME 0x24 (36) Home key.
DOM_VK_LEFT 0x25 (37) Left arrow.
DOM_VK_UP 0x26 (38) Up arrow.
DOM_VK_RIGHT 0x27 (39) Right arrow.
DOM_VK_DOWN 0x28 (40) Down arrow.
DOM_VK_SELECT 0x29 (41) Linux support for this keycode was added in Gecko 4.0.
DOM_VK_PRINT 0x2A (42) Linux support for this keycode was added in Gecko 4.0.
DOM_VK_EXECUTE 0x2B (43) Linux support for this keycode was added in Gecko 4.0.
DOM_VK_PRINTSCREEN 0x2C (44) Print Screen key.
DOM_VK_INSERT 0x2D (45) Ins(ert) key.
DOM_VK_DELETE 0x2E (46) Del(ete) key.
DOM_VK_0 0x30 (48) "0" key in standard key location.
DOM_VK_1 0x31 (49) "1" key in standard key location.
DOM_VK_2 0x32 (50) "2" key in standard key location.
DOM_VK_3 0x33 (51) "3" key in standard key location.
DOM_VK_4 0x34 (52) "4" key in standard key location.
DOM_VK_5 0x35 (53) "5" key in standard key location.
DOM_VK_6 0x36 (54) "6" key in standard key location.
DOM_VK_7 0x37 (55) "7" key in standard key location.
DOM_VK_8 0x38 (56) "8" key in standard key location.
DOM_VK_9 0x39 (57) "9" key in standard key location.
DOM_VK_COLON 0x3A (58) Colon (":") key.
DOM_VK_SEMICOLON 0x3B (59) Semicolon (";") key.
DOM_VK_LESS_THAN 0x3C (60) Less-than ("<") key.
DOM_VK_EQUALS 0x3D (61) Equals ("=") key.
DOM_VK_GREATER_THAN 0x3E (62) Greater-than (">") key.
DOM_VK_QUESTION_MARK 0x3F (63) Question mark ("?") key.
DOM_VK_AT 0x40 (64) Atmark ("@") key.
DOM_VK_A 0x41 (65) "A" key.
DOM_VK_B 0x42 (66) "B" key.
DOM_VK_C 0x43 (67) "C" key.
DOM_VK_D 0x44 (68) "D" key.
DOM_VK_E 0x45 (69) "E" key.
DOM_VK_F 0x46 (70) "F" key.
DOM_VK_G 0x47 (71) "G" key.
DOM_VK_H 0x48 (72) "H" key.
DOM_VK_I 0x49 (73) "I" key.
DOM_VK_J 0x4A (74) "J" key.
DOM_VK_K 0x4B (75) "K" key.
DOM_VK_L 0x4C (76) "L" key.
DOM_VK_M 0x4D (77) "M" key.
DOM_VK_N 0x4E (78) "N" key.
DOM_VK_O 0x4F (79) "O" key.
DOM_VK_P 0x50 (80) "P" key.
DOM_VK_Q 0x51 (81) "Q" key.
DOM_VK_R 0x52 (82) "R" key.
DOM_VK_S 0x53 (83) "S" key.
DOM_VK_T 0x54 (84) "T" key.
DOM_VK_U 0x55 (85) "U" key.
DOM_VK_V 0x56 (86) "V" key.
DOM_VK_W 0x57 (87) "W" key.
DOM_VK_X 0x58 (88) "X" key.
DOM_VK_Y 0x59 (89) "Y" key.
DOM_VK_Z 0x5A (90) "Z" key.
DOM_VK_WIN 0x5B (91) Windows logo key on Windows. Or Super or Hyper key on Linux.
DOM_VK_CONTEXT_MENU 0x5D (93) Opening context menu key.
DOM_VK_SLEEP 0x5F (95) Linux support for this keycode was added in Gecko 4.0.
DOM_VK_NUMPAD0 0x60 (96) "0" on the numeric keypad.
DOM_VK_NUMPAD1 0x61 (97) "1" on the numeric keypad.
DOM_VK_NUMPAD2 0x62 (98) "2" on the numeric keypad.
DOM_VK_NUMPAD3 0x63 (99) "3" on the numeric keypad.
DOM_VK_NUMPAD4 0x64 (100) "4" on the numeric keypad.
DOM_VK_NUMPAD5 0x65 (101) "5" on the numeric keypad.
DOM_VK_NUMPAD6 0x66 (102) "6" on the numeric keypad.
DOM_VK_NUMPAD7 0x67 (103) "7" on the numeric keypad.
DOM_VK_NUMPAD8 0x68 (104) "8" on the numeric keypad.
DOM_VK_NUMPAD9 0x69 (105) "9" on the numeric keypad.
DOM_VK_MULTIPLY 0x6A (106) "*" on the numeric keypad.
DOM_VK_ADD 0x6B (107) "+" on the numeric keypad.
DOM_VK_SEPARATOR 0x6C (108)  
DOM_VK_SUBTRACT 0x6D (109) "-" on the numeric keypad.
DOM_VK_DECIMAL 0x6E (110) Decimal point on the numeric keypad.
DOM_VK_DIVIDE 0x6F (111) "/" on the numeric keypad.
DOM_VK_F1 0x70 (112) F1 key.
DOM_VK_F2 0x71 (113) F2 key.
DOM_VK_F3 0x72 (114) F3 key.
DOM_VK_F4 0x73 (115) F4 key.
DOM_VK_F5 0x74 (116) F5 key.
DOM_VK_F6 0x75 (117) F6 key.
DOM_VK_F7 0x76 (118) F7 key.
DOM_VK_F8 0x77 (119) F8 key.
DOM_VK_F9 0x78 (120) F9 key.
DOM_VK_F10 0x79 (121) F10 key.
DOM_VK_F11 0x7A (122) F11 key.
DOM_VK_F12 0x7B (123) F12 key.
DOM_VK_F13 0x7C (124) F13 key.
DOM_VK_F14 0x7D (125) F14 key.
DOM_VK_F15 0x7E (126) F15 key.
DOM_VK_F16 0x7F (127) F16 key.
DOM_VK_F17 0x80 (128) F17 key.
DOM_VK_F18 0x81 (129) F18 key.
DOM_VK_F19 0x82 (130) F19 key.
DOM_VK_F20 0x83 (131) F20 key.
DOM_VK_F21 0x84 (132) F21 key.
DOM_VK_F22 0x85 (133) F22 key.
DOM_VK_F23 0x86 (134) F23 key.
DOM_VK_F24 0x87 (135) F24 key.
DOM_VK_NUM_LOCK 0x90 (144) Num Lock key.
DOM_VK_SCROLL_LOCK 0x91 (145) Scroll Lock key.
DOM_VK_WIN_OEM_FJ_JISHO 0x92 (146) An OEM specific key on Windows. This was used for "Dictionary" key on Fujitsu OASYS. Requires Gecko 21.0
DOM_VK_WIN_OEM_FJ_MASSHOU 0x93 (147) An OEM specific key on Windows. This was used for "Unregister word" key on Fujitsu OASYS. Requires Gecko 21.0
DOM_VK_WIN_OEM_FJ_TOUROKU 0x94 (148) An OEM specific key on Windows. This was used for "Register word" key on Fujitsu OASYS. Requires Gecko 21.0
DOM_VK_WIN_OEM_FJ_LOYA 0x95 (149) An OEM specific key on Windows. This was used for "Left OYAYUBI" key on Fujitsu OASYS. Requires Gecko 21.0
DOM_VK_WIN_OEM_FJ_ROYA 0x96 (150) An OEM specific key on Windows. This was used for "Right OYAYUBI" key on Fujitsu OASYS. Requires Gecko 21.0
DOM_VK_CIRCUMFLEX 0xA0 (160) Circumflex ("^") key.
DOM_VK_EXCLAMATION 0xA1 (161) Exclamation ("!") key.
DOM_VK_DOUBLE_QUOTE 0xA3 (162) Double quote (""") key.
DOM_VK_HASH 0xA3 (163) Hash ("#") key.
DOM_VK_DOLLAR 0xA4 (164) Dollar sign ("$") key.
DOM_VK_PERCENT 0xA5 (165) Percent ("%") key.
DOM_VK_AMPERSAND 0xA6 (166) Ampersand ("&") key.
DOM_VK_UNDERSCORE 0xA7 (167) Underscore ("_") key.
DOM_VK_OPEN_PAREN 0xA8 (168) Open parenthesis ("(") key.
DOM_VK_CLOSE_PAREN 0xA9 (169) Close parenthesis (")") key.
DOM_VK_ASTERISK 0xAA (170) Asterisk ("*") key.
DOM_VK_PLUS 0xAB (171) Plus ("+") key.
DOM_VK_PIPE 0xAC (172) Pipe ("|") key.
DOM_VK_HYPHEN_MINUS 0xAD (173) Hyphen-US/docs/Minus ("-") key.
DOM_VK_OPEN_CURLY_BRACKET 0xAE (174) Open curly bracket ("{") key.
DOM_VK_CLOSE_CURLY_BRACKET 0xAF (175) Close curly bracket ("}") key.
DOM_VK_TILDE 0xB0 (176) Tilde ("~") key.
DOM_VK_VOLUME_MUTE 0xB5 (181) Audio mute key. Requires Gecko 21.0
DOM_VK_VOLUME_DOWN 0xB6 (182) Audio volume down key Requires Gecko 21.0
DOM_VK_VOLUME_UP 0xB7 (183) Audio volume up key Requires Gecko 21.0
DOM_VK_COMMA 0xBC (188) Comma (",") key.
DOM_VK_PERIOD 0xBE (190) Period (".") key.
DOM_VK_SLASH 0xBF (191) Slash ("/") key.
DOM_VK_BACK_QUOTE 0xC0 (192) Back tick ("`") key.
DOM_VK_OPEN_BRACKET 0xDB (219) Open square bracket ("[") key.
DOM_VK_BACK_SLASH 0xDC (220) Back slash ("\") key.
DOM_VK_CLOSE_BRACKET 0xDD (221) Close square bracket ("]") key.
DOM_VK_QUOTE 0xDE (222) Quote (''') key.
DOM_VK_META 0xE0 (224) Meta key on Linux, Command key on Mac.
DOM_VK_ALTGR 0xE1 (225) AltGr key (Level 3 Shift key or Level 5 Shift key) on Linux.
DOM_VK_WIN_ICO_HELP 0xE3 (227) An OEM specific key on Windows. This is (was?) used for Olivetti ICO keyboard.Requires Gecko 21.0
DOM_VK_WIN_ICO_00 0xE4 (228) An OEM specific key on Windows. This is (was?) used for Olivetti ICO keyboard.Requires Gecko 21.0
DOM_VK_WIN_ICO_CLEAR 0xE6 (230) An OEM specific key on Windows. This is (was?) used for Olivetti ICO keyboard.Requires Gecko 21.0
DOM_VK_WIN_OEM_RESET 0xE9 (233) An OEM specific key on Windows. This was used for Nokia/Ericsson's device.Requires Gecko 21.0
DOM_VK_WIN_OEM_JUMP 0xEA (234) An OEM specific key on Windows. This was used for Nokia/Ericsson's device.Requires Gecko 21.0
DOM_VK_WIN_OEM_PA1 0xEB (235) An OEM specific key on Windows. This was used for Nokia/Ericsson's device.Requires Gecko 21.0
DOM_VK_WIN_OEM_PA2 0xEC (236) An OEM specific key on Windows. This was used for Nokia/Ericsson's device.Requires Gecko 21.0
DOM_VK_WIN_OEM_PA3 0xED (237) An OEM specific key on Windows. This was used for Nokia/Ericsson's device.Requires Gecko 21.0
DOM_VK_WIN_OEM_WSCTRL 0xEE (238) An OEM specific key on Windows. This was used for Nokia/Ericsson's device.Requires Gecko 21.0
DOM_VK_WIN_OEM_CUSEL 0xEF (239) An OEM specific key on Windows. This was used for Nokia/Ericsson's device.Requires Gecko 21.0
DOM_VK_WIN_OEM_ATTN 0xF0 (240) An OEM specific key on Windows. This was used for Nokia/Ericsson's device.Requires Gecko 21.0
DOM_VK_WIN_OEM_FINISH 0xF1 (241) An OEM specific key on Windows. This was used for Nokia/Ericsson's device.Requires Gecko 21.0
DOM_VK_WIN_OEM_COPY 0xF2 (242) An OEM specific key on Windows. This was used for Nokia/Ericsson's device.Requires Gecko 21.0
DOM_VK_WIN_OEM_AUTO 0xF3 (243) An OEM specific key on Windows. This was used for Nokia/Ericsson's device.Requires Gecko 21.0
DOM_VK_WIN_OEM_ENLW 0xF4 (244) An OEM specific key on Windows. This was used for Nokia/Ericsson's device.Requires Gecko 21.0
DOM_VK_WIN_OEM_BACKTAB 0xF5 (245) An OEM specific key on Windows. This was used for Nokia/Ericsson's device.Requires Gecko 21.0
DOM_VK_ATTN 0xF6 (246) Attn (Attension) key of IBM midrange computers, e.g., AS/400. Requires Gecko 21.0
DOM_VK_CRSEL 0xF7 (247) CrSel (Cursor Selection) key of IBM 3270 keyboard layout. Requires Gecko 21.0
DOM_VK_EXSEL 0xF8 (248) ExSel (Extend Selection) key of IBM 3270 keyboard layout. Requires Gecko 21.0
DOM_VK_EREOF 0xF9 (249) Erase EOF key of IBM 3270 keyboard layout. Requires Gecko 21.0
DOM_VK_PLAY 0xFA (250) Play key of IBM 3270 keyboard layout. Requires Gecko 21.0
DOM_VK_ZOOM 0xFB (251) Zoom key. Requires Gecko 21.0
DOM_VK_PA1 0xFD (253) PA1 key of IBM 3270 keyboard layout. Requires Gecko 21.0
DOM_VK_WIN_OEM_CLEAR 0xFE (254) Clear key, but we're not sure the meaning difference from DOM_VK_CLEAR. Requires Gecko 21.0

OEM specific keys on Windows

On Windows, some values of virtual keycode are defined (reserved) for OEM specific key. They are available for special keys on non-standard keyboard. In other words, some values are used for different meaning by two or more venders (or hardware).

Starting Gecko 21 (and older than 15), OEM specific key values are available on the keyCode attribute only on Windows. So,  they are not useful for usual web applications. They are useful only for intranet applications or in similar situations.

See "Manufacturer-specific Virtual-Key Codes (Windows CE 5.0)" in MSDN for the detail.

Key location constants

These constants describe the location on the keyboard of key events. DOM level 3

Constant Value Description
DOM_KEY_LOCATION_STANDARD 0 The key must not be distinguished between the left and right versions of the key, and was not pressed on the numeric keypad or a key that is considered to be part of the keypad.
DOM_KEY_LOCATION_LEFT 1 The key was the left-hand version of the key; for example, this is the value of the location attribute when the left-hand Control key is pressed on a standard 101 key US keyboard. This value is only used for keys that have more that one possible location on the keyboard.
DOM_KEY_LOCATION_RIGHT 2 The key was the right-hand version of the key; for example, this is the value of the location attribute when the right-hand Control key is pressed on a standard 101 key US keyboard. This value is only used for keys that have more that one possible location on the keyboard.
DOM_KEY_LOCATION_NUMPAD 3

The key was on the numeric keypad, or has a virtual key code that corresponds to the numeric keypad.

Note: When NumLock is locked, Gecko always returns DOM_KEY_LOCATION_NUMPAD for the keys on NumPad. Otherwise, when NumLock is unlocked and the keyboard actually has a numeric keypad, Gecko always returns DOM_KEY_LOCATION_NUMPAD too. On the other hand, if the keyboard doesn't have a keypad, such as on a notebook computer, some keys become Numpad only when NumLock is locked. When such keys fires key events, the location attribute value depends on the key. That is, it must not be DOM_KEY_LOCATION_NUMPAD.
Note: NumLock key's key events indicate DOM_KEY_LOCATION_STANDARD both on Gecko and Internet Explorer.
DOM_KEY_LOCATION_MOBILE 4

The key was on a mobile device; this can be on either a physical keypad or a virtual keyboard.

Note: Gecko always returns DOM_KEY_LOCATION_MOBILE on Android (Prior to 18), Maemo, and Boot to Gecko.
Warning: This value has been dropped from the latest D3E spec. Gecko will drop this support. bug 936313
DOM_KEY_LOCATION_JOYSTICK 5

The key was a button on a game controller or a joystick on a mobile device.

Note: Gecko never fires trusted key events with DOM_KEY_LOCATION_JOYSTICK except on Android. Starting 18, native key events on Android may have this value.
Warning: This value has been dropped from the latest D3E spec. Gecko will drop this support. bug 936313

Methods

getModifierState()

Returns the current state of the specified modifier key. DOM level 3

boolean getModifierState(
  in DOMString keyArg
);
Parameters
keyArg
A string identifying the modifier key whose value you wish to determine. This may be an implementation-defined value or one of: "Alt", "AltGraph", "CapsLock", "Control", "Fn", "Meta", "NumLock", "ScrollLock", "Shift", "SymbolLock", or "OS". Note that IE9 uses "Scroll" for "ScrollLock" and "Win" for "OS". If you use these older draft's name, Gecko's getModifierState() always returns false.
Return value

true if the specified modifier key is engaged; otherwise false.

When getModifierState() returns true on Gecko?
  Windows Linux (GTK) Mac Android 2.3 Android 3.o or latter
"Alt" Either Alt key or AltGr key pressed Alt key pressed option key pressed Alt key or option key pressed
"AltGraph"

Both Alt and Ctrl keys are pressed, or AltGr key is pressed

Level 3 Shift key (or Level 5 Shift key Requires Gecko 20.0) pressed option key pressed Not supported
"CapsLock" During LED for Caps Lock turned on Not supported While CapsLock is locked Requires Gecko 29.0
"Control" Either Ctrl key or AltGr key pressed Ctrl key pressed control key pressed menu key  pressed. Ctrl key, control key or menu key  pressed.
"Fn" Not supportedNot supported Function key is pressed, but we're not sure what key make the meta state active. Fn key on Mac keyboard doesn't cause this. Requires Gecko 29.0
"Meta" Not supported Meta key pressed command key pressed Not supported Windows Logo key or command key pressed
"NumLock" During LED for Num Lock turned on A key on numpad pressed Not supported While NumLock is locked Requires Gecko 29.0
"ScrollLock" During LED for Scroll Lock turned on During LED for Scroll Lock turned on, but typically this isn't supported by platform Not supported While ScrollLock is locked Requires Gecko 29.0
"Shift" Shift key pressed
"SymbolLock" Not supported
"OS" Windows Logo key pressed Super key or Hyper key pressed (typically, mapped to Windows Logo key) Not supported

On the other platforms, "Alt", "Control" and "Shift" may be supported.

All modifiers are always supported for untrusted events on Gecko. This doesn't depend on the platform.

initKeyboardEvent()

Deprecated
This feature has been removed from the Web. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.

Initializes the attributes of a keyboard event object. This method was introduced in draft of DOM Level 3 Events, but deprecated in newer draft. Gecko doesn't implement this method but there is similar one, see initKeyEvent().

void initKeyboardEvent(
  in DOMString typeArg,
  in boolean canBubbleArg,
  in boolean cancelableArg,
  in views::AbstractView viewArg,
  in DOMString charArg,
  in DOMString keyArg,
  in unsigned long locationArg,
  in DOMString modifiersListArg,
  in boolean repeat
);
Parameters
typeArg
The type of keyboard event; this will be one of keydown, keypress, or keyup.
canBubbleArg
Whether or not the event can bubble.
cancelableArg
Whether or not the event can be canceled.
viewArg
?
charArg
The value of the char attribute.
keyArg
The value of the key attribute.
locationArg
The value of the location attribute.
modifiersListArg
A whitespace-delineated list of modifier keys that should be considered to be active on the event's key. For example, specifying "Control Shift" indicates that the user was holding down the Control and Shift keys when pressing the key described by the event.
repeatArg
The value of the repeat attribute.

Note: initKeyboardEvent() of IE has an additional argument for initializing locale attribute after repeatArg.  However, it was dropped from the spec of DOM Level 3 Events. Gecko doesn't have any problem you to call this method with the localeArg.

There are keydown, keypress, and keyup events. For most keys, Gecko dispatches a sequence of key events like this:

  1. When the key is first depressed, the keydown event is sent.
  2. If the key is not a modifier key, the keypress event is sent.
  3. When the user releases the key, the keyup event is sent.

Special cases

Certain keys toggle the state of an LED indicator, such as Caps Lock, Num Lock, and Scroll Lock. On Windows and Linux, these keys dispatch only the keydown and keyup events. Note that on Linux, Firefox 12 and earlier also dispatched the keypress event for these keys.

On Mac, however, Caps Lock dispatches only the keydown event due to a platform event model limitation. Num Lock had been supported on old MacBook (2007 model and older) but Mac hasn't supported Num Lock feature even on external keyboards in these days. On the old MacBook which has Num Lock key, Num Lock doesn't cause any key events. And Gecko supports Scroll Lock key if an external keyboard which has F14 is connected. However, it generates keypress event. This inconsistent behavior is a bug; see bug 602812.

Auto-repeat handling

When a key is pressed and held down, it begins to auto-repeat. This results in a sequence of events similar to the following being dispatched:

  1. keydown
  2. keypress
  3. keydown
  4. keypress
  5. <<repeating until the user releases the key>>
  6. keyup

This is what the DOM Level 3 specification says should happen. There are some caveats, however, as described below.

Auto-repeat on some GTK environments such as Ubuntu 9.4

In some GTK-based environments, auto-repeat dispatches a native key-up event automatically during auto-repeat, and there's no way for Gecko to know the difference between a repeated series of keypresses and an auto-repeat. On those platforms, then, an auto-repeat key will generate the following sequence of events:

  1. keydown
  2. keypress
  3. keyup
  4. keydown
  5. keypress
  6. keyup
  7. <<repeating until the user releases the key>>
  8. keyup

In these environments, unfortunately, there's no way for web content to tell the difference between auto-repeating keys and keys that are just being pressed repeatedly.

Auto-repeat handling prior to Gecko 4.0

Before Gecko 4.0 , keyboard handling was less consistent across platforms.

Windows
Auto-repeat behavior is the same as in Gecko 4.0 and later.
Mac
After the initial keydown event, only keypress events are sent until the keyup event occurs; the inter-spaced keydown events are not sent.
Linux
The event behavior depends on the specific platform. It will either behave like Windows or Mac depending on what the native event model does.

Key names

Following tables show what key names are used for each native virtual keycode.

Key names on Windows (and char values of IE)
Virtual-Key Codes IE 9 IE 9 (.char) Gecko Requires Gecko 23.0 Gecko (with new WD, plan)
VK_LBUTTON (0x01) "Unidentified" null "Unidentified" "Unidentified"
VK_RBUTTON (0x02) "Unidentified" null "Unidentified" "Unidentified"
VK_CANCEL (0x03) "" U+0003 "Cancel" "Cancel"
VK_MBUTTON (0x04) "Unidentified" null "Unidentified" "Unidentified"
VK_XBUTTON1 (0x05) "Unidentified" null "Unidentified" "Unidentified"
VK_XBUTTON2 (0x06) "Unidentified" null "Unidentified" "Unidentified"
VK_BACK (0x08) "Backspace" U+0008 "Backspace" "Backspace"
VK_TAB (0x09) "Tab" U+0009 "Tab" "Tab"
VK_CLEAR (0x0C) "Clear" null "Clear" "Clear"
VK_RETURN (0x0D) "Enter" U+000A for keydown,
U+000D for keypress
"Enter" "Enter"
VK_SHIFT (0x10) "Shift" null "Shift" "Shift"
VK_CONTROL (0x11) "Control" null "Control" "Control"
VK_MENU (0x12) "Alt" null "Alt" "Alt"
VK_PAUSE (0x13) "Pause" null "Pause" "Pause"
VK_CAPITAL (0x14) "CapsLock" null "CapsLock" "CapsLock"
VK_KANA,
VK_HANGUEL,
VK_HANGUL (0x15)
"KanaMode" null "KanaMode"

"KanaMode" for Japanese keyboard layout, "HangulMode" for Korean keyboard layout, "Unidentified" for the others. Requires Gecko 25.0
"KanaMode" for Japanese keyboard layout, "HangulMode" for Korean keyboard layout, "Unidentified" for the others.
VK_JUNJA (0x17) "JunjaMode" null "JunjaMode" "JunjaMode"
VK_FINAL (0x18) "HanjaMode" null "HanjaMode"

"FinalMode" Requires Gecko 25.0
"FinalMode"
VK_HANJA,
VK_KANJI (0x19)
"KanjiMode" null "KanjiMode"

"KanjiMode" for Japanese keyboard layout, "HanjaMode" for Korean keyboard layout, "Unidentified" for the others. Requires Gecko 25.0
"KanjiMode" for Japanese keyboard layout, "HanjaMode" for Korean keyboard layout, "Unidentified" for the others.
VK_ESCAPE (0x1B) "Esc" U+001B "Esc" "Escape"
VK_CONVERT (0x1C) "Convert" null "Convert" "Convert"
VK_NONCONVERT (0x1D) "Nonconvert" null "Nonconvert" "NonConvert"
VK_ACCEPT (0x1E) "Accept" null "Accept" "Accept"
VK_MODECHANGE (0x1F) "ModeChange" null "ModeChange" "ModeChange"
VK_SPACE (0x20) "Spacebar" Depends on actual inputted character "Spacebar" Actual input character. Requires Gecko 29.0
VK_PRIOR (0x21) "PageUp" null "PageUp" "PageUp"
VK_NEXT (0x22) "PageDown" null "PageDown" "PageDown"
VK_END (0x23) "End" null "End" "End"
VK_HOME (0x24) "Home" null "Home" "Home"
VK_LEFT (0x25) "Left" null "Left" "ArrowLeft"
VK_UP (0x26) "Up" null "Up" "ArrowUp"
VK_RIGHT (0x27) "Right" null "Right" "ArrowRight"
VK_DOWN (0x28) "Down" null "Down" "ArrowDown"
VK_SELECT (0x29) "Select" null "Select" ? (Spec bug 23751)
VK_PRINT (0x2A) "Unidentified" null "Unidentified" "Print"
VK_EXECUTE (0x2B) "Execute" null "Execute" "Execute"
VK_SNAPSHOT (0x2C) "PrintScreen" null "PrintScreen" "PrintScreen"
VK_INSERT (0x2D) "Insert" null "Insert" "Insert"
VK_DELETE (0x2E) "Del" null "Del" "Delete"
VK_HELP (0x2F) "Help" null "Help" "Help"
VK_LWIN (0x5B) "Win" null "OS" "OS"
VK_RWIN (0x5C) "Win" null "OS" "OS"
VK_APPS (0x5D) "Apps" null "Menu" "ContextMenu"
VK_SLEEP (0x5F) "Unidentified" null "Unidentified" (Spec bug 21118) "Standby"
VK_NUMPAD0 (0x60)VK_NUMPAD9 (0x69) "0" ~ "9" "0" ~ "9" Actual input character. Actual input character.
VK_MULTIPLY (0x6A) "Multiply" "*" "Multiply" Actual input character. Requires Gecko 29.0
VK_ADD (0x6B) "Add" "+" "Add" Actual input character. Requires Gecko 29.0
VK_SEPARATOR (0x6C) "Separator" null "Separator" Actual input character. Requires Gecko 29.0
VK_SUBTRACT (0x6D) "Subtract" "-" "Subtract" Actual input character. Requires Gecko 29.0
VK_DECIMAL (0x6E) "Decimal" "." "Decimal" Actual input character. Requires Gecko 29.0
VK_DIVIDE (0x6F) "Divide" "/" "Divide" Actual input character. Requires Gecko 29.0
VK_F1 (0x70)VK_F24 (0x87) "F1" ~ "F24" null "F1" ~ "F24" "F1" ~ "F24"
VK_NUMLOCK (0x90) "NumLock" null "NumLock" "NumLock"
VK_SCROLL (0x91) "Scroll" null "ScrollLock" "ScrollLock"
VK_LSHIFT (0xA0) "Shift" null "Shift" "Shift"
VK_RSHIFT (0xA1) "Shift" null "Shift" "Shift"
VK_LCONTROL (0xA2) "Control" null "Control" "Control"
VK_RCONTROL (0xA3) "Control" null "Control" "Control"
VK_LMENU (0xA4) "Alt" null "Alt" "Alt"
VK_RMENU (0xA5) "Alt" null "Alt" "Alt"
VK_BROWSER_BACK (0xA6) "BrowserBack" null "BrowserBack" "BrowserBack"
VK_BROWSER_FORWARD (0xA7) "BrowserForward" null "BrowserForward" "BrowserForward"
VK_BROWSER_REFRESH (0xA8) "BrowserRefresh" null "BrowserRefresh" "BrowserRefresh"
VK_BROWSER_STOP (0xA9) "BrowserStop" null "BrowserStop" "BrowserStop"
VK_BROWSER_SEARCH (0xAA) "BrowserSearch" null "BrowserSearch" "BrowserSearch"
VK_BROWSER_FAVORITES (0xAB) "BrowserFavorites" null "BrowserFavorites" "BrowserFavorites"
VK_BROWSER_HOME (0xAC) "BrowserHome" null "BrowserHome" "BrowserHome"
VK_VOLUME_MUTE (0xAD) "VolumeMute" null "VolumeMute" "VolumeMute"
VK_VOLUME_DOWN (0xAE) "VolumeDown" null "VolumeDown" "VolumeDown"
VK_VOLUME_UP (0xAF) "VolumeUp" null "VolumeUp" "VolumeUp"
VK_MEDIA_NEXT_TRACK (0xB0) "MediaNextTrack" null "MediaNextTrack" "MediaTrackNext"
VK_MEDIA_PREV_TRACK (0xB1) "MediaPreviousTrack" null "MediaPreviousTrack" "MediaTrackPrevious"
VK_MEDIA_STOP (0xB2) "MediaStop" null "MediaStop" "MediaStop"
VK_MEDIA_PLAY_PAUSE (0xB3) "MediaPlayPause" null "MediaPlayPause" "MediaPlayPause"
VK_LAUNCH_MAIL (0xB4) "LaunchMail" null "LaunchMail" "LaunchMail"
VK_LAUNCH_MEDIA_SELECT (0xB5) "SelectMedia" null "SelectMedia" "MediaSelect"
VK_LAUNCH_APP1 (0xB6) "LaunchApplication1" null "LaunchApplication1" "LaunchApplication1"
VK_LAUNCH_APP2 (0xB7) "LaunchApplication2" null "LaunchApplication2" "LaunchApplication2"
VK_PROCESSKEY (0xE5) "Unidentified" (tested without IME) null "Unidentified" "Unidentified"
VK_PACKET (0xE7) U+0000 (null character at 1st, tested without SendInput() API) null "Unidentified" "Unidentified"
VK_OEM_RESET (0xE9) "Unidentified" null "Unidentified" "Unidentified"
VK_OEM_JUMP (0xEA) "Unidentified" null "Unidentified" "Unidentified"
VK_OEM_PA1 (0xEB) "Unidentified" null "Unidentified" "Unidentified"
VK_OEM_PA2 (0xEC) "Unidentified" null "Unidentified" "Unidentified"
VK_OEM_PA3 (0xED) "Unidentified" null "Unidentified" "Unidentified"
VK_OEM_WSCTRL (0xEE) "Unidentified" null "Unidentified" "Unidentified"
VK_OEM_CUSEL (0xEF) "Unidentified" null "Unidentified" "Unidentified"
VK_OEM_ATTN (0xF0) "Unidentified" null "Unidentified"

"Alphanumeric" for Japanese keyboard layout, "Unidentified" for the others. Requires Gecko 25.0
"Alphanumeric" for Japanese keyboard layout, "Unidentified" for the others.
VK_OEM_FINISH (0xF1) "Unidentified" null "Unidentified"

"Katakana" for Japanese keyboard layout, "Unidentified" for the others. Requires Gecko 25.0
"Katakana" for Japanese keyboard layout, "Unidentified" for the others.
VK_OEM_COPY (0xF2) "Unidentified" null "Unidentified"

"Hiragana" for Japanese keyboard layout, "Unidentified" for the others. Requires Gecko 25.0
"Hiragana" for Japanese keyboard layout, "Unidentified" for the others.
VK_OEM_AUTO (0xF3) "Unidentified" null "Unidentified"

"HalfWidth" for Japanese keyboard layout, "Unidentified" for the others. Requires Gecko 25.0
"Hankaku" for Japanese keyboard layout, "Unidentified" for the others.
VK_OEM_ENLW (0xF4) "Unidentified" null "Unidentified"

"FullWidth" for Japanese keyboard layout, "Unidentified" for the others. Requires Gecko 25.0
"Zenkaku" for Japanese keyboard layout, "Unidentified" for the others.
VK_OEM_BACKTAB (0xF5) "Unidentified" null "Unidentified"

"RomanCharacters" for Japanese keyboard layout, "Unidentified" for the others. Requires Gecko 25.0
"RomanCharacters" for Japanese keyboard layout, "Unidentified" for the others.
VK_ATTN (0xF6) "Attn" null "Attn"

"KanaMode" for Japanese keyboard layout, "Attn" for the others. Requires Gecko 25.0
"KanaMode" for Japanese keyboard layout, "Attn" for the others.
VK_CRSEL (0xF7) "Crsel" null "Crsel" "CrSel"
VK_EXSEL (0xF8) "Exsel" null "Exsel" "ExSel"
VK_EREOF (0xF9) "EraseEof" null "EraseEof" "EraseEof"
VK_PLAY (0xFA) "Play" null "Play" "Play"
VK_ZOOM (0xFB) "Zoom" null "Zoom" "ZoomToggle"
VK_NONAME (0xFC) "Unidentified" null "Unidentified" "Unidentified"
VK_PA1 (0xFD) "Unidentified" null "Unidentified" "Unidentified"
VK_OEM_CLEAR (0xFE) "Clear" null "Clear" "Clear"
Key names on Mac
Native virtual keycodes Gecko Requires Gecko 23.0 Gecko (with new WD, plan)
kVK_ISO_Section (0x0A) "Unidentified" "Unidentified"
kVK_Return (0x24) "Enter" "Enter"
kVK_Tab (0x30) "Tab" "Tab"
kVK_Space (0x31) "Spacebar" Actual input character. Requires Gecko 29.0
kVK_Delete (0x33) "Backspace" "Backspace"
Enter key on keypad of PowerBook (0x34) "Enter" "Enter"
kVK_Escape (0x35) "Esc" "Escape"
right-command key (0x36) "Meta" "Meta"
kVK_Command (0x37) "Meta" "Meta"
kVK_Shift (0x38) "Shift" "Shift"
kVK_CapsLock (0x39) "CapsLock" "CapsLock"
kVK_Option (0x3A) "Alt" "Alt"
kVK_Control (0x3B) "Control" "Control"
kVK_RightShift (0x3C) "Shift" "Shift"
kVK_RightOption (0x3D) "Alt" "Alt"
kVK_RightControl (0x3E) "Control" "Control"
kVK_Function (0x3F) "Fn" "Fn"
kVK_F17 (0x40) "F17" "F17"
kVK_ANSI_KeypadDecimal (0x41) "Decimal" Actual input character. Requires Gecko 29.0
kVK_ANSI_KeypadMultiply (0x43) "Multiply" Actual input character. Requires Gecko 29.0
kVK_ANSI_KeypadPlus (0x45) "Add" Actual input character. Requires Gecko 29.0
kVK_ANSI_KeypadClear (0x47) "Clear" "Clear"
kVK_VolumeUp (0x48) "VolumeUp" "VolumeUp"
kVK_VolumeDown (0x49) "VolumeDown" "VolumeDown"
kVK_Mute (0x4A) "VolumeMute" "VolumeMute"
kVK_ANSI_KeypadDivide (0x4B) "Divide" Actual input character. Requires Gecko 29.0
kVK_ANSI_KeypadEnter (0x4C) "Enter" "Enter"
kVK_ANSI_KeypadMinus (0x4E) "Subtract" Actual input character. Requires Gecko 29.0
kVK_F18 (0x4F) "F18" "F18"
kVK_F19 (0x50) "F19" "F18"
kVK_ANSI_KeypadEquals (0x51) Actual input character. Actual input character.
kVK_ANSI_Keypad0 (0x52) Actual input character. Actual input character.
kVK_ANSI_Keypad1 (0x53) Actual input character. Actual input character.
kVK_ANSI_Keypad2 (0x54) Actual input character. Actual input character.
kVK_ANSI_Keypad3 (0x55) Actual input character. Actual input character.
kVK_ANSI_Keypad4 (0x56) Actual input character. Actual input character.
kVK_ANSI_Keypad5 (0x57) Actual input character. Actual input character.
kVK_ANSI_Keypad6 (0x58) Actual input character. Actual input character.
kVK_ANSI_Keypad7 (0x59) Actual input character. Actual input character.
kVK_F20 (0x5A) "F20" "F20"
kVK_ANSI_Keypad8 (0x5B) Actual input character. Actual input character.
kVK_ANSI_Keypad9 (0x5C) Actual input character. Actual input character.
kVK_JIS_KeypadComma (0x5F) "Separator" Actual input character. Requires Gecko 29.0
kVK_F5 (0x60) "F5" "F5"
kVK_F6 (0x61) "F6" "F6"
kVK_F7 (0x62) "F7" "F7"
kVK_F3 (0x63) "F3" "F3"
kVK_F8 (0x64) "F8" "F8"
kVK_F9 (0x65) "F9" "F9"
kVK_JIS_Eisu (0x66) "RomanCharacters" bug 896348 "Eisu"
kVK_F11 (0x67) "F11" "F11"
kVK_JIS_Kana (0x68) "KanjiMode" "KanjiMode"
kVK_F13 (0x69) "F13" "F13"
kVK_F16 (0x6A) "F16" "F16"
kVK_F14 (0x6B) "F14" "F14"
kVK_F10 (0x6D) "F10" "F10"
kVK_F12 (0x6F) "F12" "F12"
kVK_F15 (0x71) "F15" "F15"
kVK_Help (0x72) "Help" "Help"
kVK_Home (0x73) "Home" "Home"
kVK_PageUp (0x74) "PageUp" "PageUp"
kVK_ForwardDelete (0x75) "Del" "Delete"
kVK_F4 (0x76) "F4" "F4"
kVK_End (0x77) "End" "End"
kVK_F2 (0x78) "F2" "F2"
kVK_PageDown (0x79) "PageDown" "PageDown"
kVK_F1 (0x7A) "F1" "F1"
kVK_LeftArrow (0x7B) "Left" "ArrowLeft"
kVK_RightArrow (0x7C) "Right" "ArrowRight"
kVK_DownArrow (0x7D) "Down" "ArrowDown"
kVK_UpArrow (0x7E) "Up" "ArrowUp"
Key names on Android and Firefox OS
Android keycode Gecko Requires Gecko 23.0 Gecko (with new WD, plan)
AKEYCODE_UNKNOWN (0) "Unidentified" "Unidentified"
AKEYCODE_SOFT_LEFT (1) "Unidentified" (Spec bug 21083) "Unidentified"
AKEYCODE_SOFT_RIGHT (2) "Unidentified" (Spec bug 21083) "Unidentified"
AKEYCODE_HOME (3) "Exit" "Unidentified" ?
AKEYCODE_BACK (4) "BrowserBack" "BrowserBack"
AKEYCODE_CALL (5) "Unidentified" (Spec bug 21121) "Unidentified"
AKEYCODE_ENDCALL (6) "Unidentified" (Spec bug 21121) "Unidentified"
AKEYCODE_0 (7)AKEYCODE_9 (16) Actual input character. Actual input character.
AKEYCODE_STAR (17) Actual input character. Actual input character.
AKEYCODE_POUND (18) Actual input character. Actual input character.
AKEYCODE_DPAD_UP (19) "Up" "ArrowUp"
AKEYCODE_DPAD_DOWN (20) "Down" "ArrowDown"
AKEYCODE_DPAD_LEFT (21) "Left" "ArrowLeft"
AKEYCODE_DPAD_RIGHT (22) "Right" "ArrorRight"
AKEYCODE_DPAD_CENTER (23) "Accept" "Accept"
AKEYCODE_VOLUME_UP (24) "VolumeUp" "VolumeUp"
AKEYCODE_VOLUME_DOWN (25) "VolumeDown" "VolumeDown"
AKEYCODE_POWER (26) "Power" "Power"
AKEYCODE_CAMERA (27) "Camera" "Camera"
AKEYCODE_CLEAR (28) "Clear" "Clear"
AKEYCODE_A (29)AKEYCODE_Z (54) Actual input character. Actual input character.
AKEYCODE_COMMA (55) Actual input character. Actual input character.
AKEYCODE_PERIOD (56) Actual input character. Actual input character.
AKEYCODE_ALT_LEFT (57) "Alt" "Alt"
AKEYCODE_ALT_RIGHT (58) "Alt" "Alt"
AKEYCODE_SHIFT_LEFT (59) "Shift" "Shift"
AKEYCODE_SHIFT_RIGHT (60) "Shift" "Shift"
AKEYCODE_TAB (61) "Tab" "Tab"
AKEYCODE_SPACE (62) "Spacebar" Actual input character. Requires Gecko 29.0
AKEYCODE_SYM (63) "Unidentified" "Symbol"
AKEYCODE_EXPLORER (64) "LaunchApplication1" "LaunchWebBrowser"
AKEYCODE_ENVELOPE (65) "LaunchMail" "LaunchMail"
AKEYCODE_ENTER (66) "Enter" "Enter"
AKEYCODE_DEL (67) "Backspace" "Backspace"
AKEYCODE_GRAVE (68) Actual input character. Actual input character.
AKEYCODE_MINUS (69) Actual input character. Actual input character.
AKEYCODE_EQUALS (70) Actual input character. Actual input character.
AKEYCODE_LEFT_BRACKET (71) Actual input character. Actual input character.
AKEYCODE_RIGHT_BRACKET (72) Actual input character. Actual input character.
AKEYCODE_BACKSLASH (73) Actual input character. Actual input character.
AKEYCODE_SEMICOLON (74) Actual input character. Actual input character.
AKEYCODE_APOSTROPHE (75) Actual input character. Actual input character.
AKEYCODE_SLASH (76) Actual input character. Actual input character.
AKEYCODE_AT (77) Actual input character. Actual input character.
AKEYCODE_NUM (78) "Unidentified" (Spec bug 21083) "Unidentified"
AKEYCODE_HEADSETHOOK (79) "Unidentified" (Spec bug 21121) "Unidentified"
AKEYCODE_FOCUS (80) "Unidentified" (Spec bug 21121) "Unidentified"
AKEYCODE_PLUS (81) Actual input character. Actual input character.
AKEYCODE_MENU (82) "Menu" "ContextMenu"
AKEYCODE_NOTIFICATION (83) "Unidentified" (Spec bug 21083) "Unidentified"
AKEYCODE_SEARCH (84) "BrowserSearch" "BrowserSearch"
AKEYCODE_MEDIA_PLAY_PAUSE (85) "MediaPlayPause" "MediaPlayPause"
AKEYCODE_MEDIA_STOP (86) "MediaStop" "MediaStop"
AKEYCODE_MEDIA_NEXT (87) "MediaNextTrack" "MediaTrackNext"
AKEYCODE_MEDIA_PREVIOUS (88) "MediaPreviousTrack" "MediaTrackPrevious"
AKEYCODE_MEDIA_REWIND (89) "MediaRewind" "MediaRewind"
AKEYCODE_MEDIA_FAST_FORWARD (90) "FastFwd" "MediaFastForward"
AKEYCODE_MUTE (91) "Unidentified" "Unidentified"
AKEYCODE_PAGE_UP (92) "PageUp" "PageUp"
AKEYCODE_PAGE_DOWN (93) "PageDown" "PageDown"
AKEYCODE_PICTSYMBOLS (94) "Unidentified" (Spec bug 21140) "Unidentified"
AKEYCODE_SWITCH_CHARSET (95) "ModeChange" "ModeChange"
AKEYCODE_BUTTON_A (96) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_BUTTON_B (97) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_BUTTON_C (98) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_BUTTON_X (99) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_BUTTON_Y (100) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_BUTTON_Z (101) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_BUTTON_L1 (102) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_BUTTON_R1 (103) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_BUTTON_L2 (104) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_BUTTON_R2 (105) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_BUTTON_THUMBL (106) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_BUTTON_THUMBR (107) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_BUTTON_START (108) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_BUTTON_SELECT (109) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_BUTTON_MODE (110) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_ESCAPE (111) "Esc" "Escape"
AKEYCODE_FORWARD_DEL (112) "Del" "Delete"
AKEYCODE_CTRL_LEFT (113) "Control" "Control"
AKEYCODE_CTRL_RIGHT (114) "Control" "Control"
AKEYCODE_CAPS_LOCK (115) "CapsLock" "CapsLock"
AKEYCODE_SCROLL_LOCK (116) "ScrollLock" "ScrollLock"
AKEYCODE_META_LEFT (117) "Meta" "Meta"
AKEYCODE_META_RIGHT (118) "Meta" "Meta"
AKEYCODE_FUNCTION (119) "Fn" "Fn"
AKEYCODE_SYSRQ (120) "PrintScreen" "PrintScreen"
AKEYCODE_BREAK (121) "Pause" "Pause"
AKEYCODE_MOVE_HOME (122) "Home" "Home"
AKEYCODE_MOVE_END (123) "End" "End"
AKEYCODE_INSERT (124) "Insert" "Insert"
AKEYCODE_FORWARD (125) "BrowserForward" "BrowserForward"
AKEYCODE_MEDIA_PLAY (126) "MediaPlay" "MediaPlay"
AKEYCODE_MEDIA_PAUSE (127) "MediaPause" "MediaPause"
AKEYCODE_MEDIA_CLOSE (128) "Unidentified" "Unidentified"
AKEYCODE_MEDIA_EJECT (129) "Eject" "Eject"
AKEYCODE_MEDIA_RECORD (130) "MediaRecord" "MediaRecord"
AKEYCODE_F1 (131)AKEYCODE_F12 (142) "F1""F12" "F1""F12"
AKEYCODE_NUM_LOCK (143) "NumLock" "NumLock"
AKEYCODE_NUMPAD_0 (144)AKEYCODE_NUMPAD_9 (153) Actual input character. Actual input character.
AKEYCODE_NUMPAD_DIVIDE (154) "Divide" Actual input character. Requires Gecko 29.0
AKEYCODE_NUMPAD_MULTIPLY (155) "Multiply" Actual input character. Requires Gecko 29.0
AKEYCODE_NUMPAD_SUBTRACT (156) "Subtract" Actual input character. Requires Gecko 29.0
AKEYCODE_NUMPAD_ADD (157) "Add" Actual input character. Requires Gecko 29.0
AKEYCODE_NUMPAD_DOT (158) "Decimal" Actual input character. Requires Gecko 29.0
AKEYCODE_NUMPAD_COMMA (159) "Separator" Actual input character. Requires Gecko 29.0
AKEYCODE_NUMPAD_ENTER (160) "Enter" "Enter"
AKEYCODE_NUMPAD_EQUALS (161) "Equals" Actual input character. Requires Gecko 29.0
AKEYCODE_NUMPAD_LEFT_PAREN (162) Actual input character. Actual input character.
AKEYCODE_NUMPAD_RIGHT_PAREN (163) Actual input character. Actual input character.
AKEYCODE_VOLUME_MUTE (164) "VolumeMute" "VolumeMute"
AKEYCODE_INFO (165) "Info" "Info"
AKEYCODE_CHANNEL_UP (166) "ChannelUp" "ChannelUp"
AKEYCODE_CHANNEL_DOWN (167) "ChannelDown" "ChannelDown"
AKEYCODE_ZOOM_IN (168) "Unidentified" (Spec bug 21119) "ZoomIn"
AKEYCODE_ZOOM_OUT (169) "Unidentified" (Spec bug 21119) "ZoomOut"
AKEYCODE_TV (170) "Live" (Spec bug 23167) "Unidentified"
AKEYCODE_WINDOW (171) "PinPToggle" "PinPToggle"
AKEYCODE_GUIDE (172) "Guide" "Guide"
AKEYCODE_DVR (173) "Unidentified" (Spec bug 23167) "Unidentified"
AKEYCODE_BOOKMARK (174) "BrowserFavorites" "BrowserFavorites"
AKEYCODE_CAPTIONS (175) "Subtitle" "Subtitle"
AKEYCODE_SETTINGS (176) "Settings" "Settings"
AKEYCODE_TV_POWER (177) "Unidentified" (Spec bug 23167) "Unidentified"
AKEYCODE_TV_INPUT (178) "Unidentified" (Spec bug 23167) "Unidentified"
AKEYCODE_STB_POWER (179) "Unidentified" (Spec bug 23167) "Unidentified"
AKEYCODE_STB_INPUT (180) "Unidentified" (Spec bug 23167) "Unidentified"
AKEYCODE_AVR_POWER (181) "Unidentified" (Spec bug 23167) "Unidentified"
AKEYCODE_AVR_INPUT (182) "Unidentified" (Spec bug 23167) "Unidentified"
AKEYCODE_PROG_RED (183) "Red" "ColorF0Red"
AKEYCODE_PROG_GREEN (184) "Green" "ColorF1Green"
AKEYCODE_PROG_YELLOW (185) "Yellow" "ColorF2Yellow"
AKEYCODE_PROG_BLUE (186) "Blue" "ColorF3Blue"
AKEYCODE_APP_SWITCH (187) "Apps" "Unidentified" ?
AKEYCODE_BUTTON_1 (188)AKEYCODE_BUTTON_16 (203) "Unidentified" (Spec bug 21137) "Unidentified"
AKEYCODE_LANGUAGE_SWITCH (204) "Unidentified" (Spec bug 21140) "GroupNext"
AKEYCODE_MANNER_MODE (205) "Unidentified" (Spec bug 21121) "Unidentified"
AKEYCODE_3D_MODE (206) "Unidentified" (Spec bug 23167) "Unidentified"
AKEYCODE_CONTACTS (207) "Unidentified" (Spec bug 21121) "Unidentified"
AKEYCODE_CALENDAR (208) "Unidentified" (Spec bug 21134) "LaunchCalendar"
AKEYCODE_MUSIC (209) "Unidentified" (Spec bug 21134) "LaunchMusicPlayer"
AKEYCODE_CALCULATOR (210) "Unidentified" (Spec bug 21134) "LaunchCalculator"
AKEYCODE_ZENKAKU_HANKAKU (211) "Unidentified" "ZenkakuHankaku"
AKEYCODE_EISU (212) "RomanCharacters" "Eisu" ?
AKEYCODE_MUHENKAN (213) "Nonconvert" "NonConvert"
AKEYCODE_HENKAN (214) "Convert" "Convert"
AKEYCODE_KATAKANA_HIRAGANA (215) "Unidentified" "HiraganaKatakana"
AKEYCODE_YEN (216) Actual input character. Actual input character.
AKEYCODE_RO (217) Actual input character. Actual input character.
AKEYCODE_KANA (218) "KanjiMode" "KanjiMode" ?
AKEYCODE_ASSIST (219) "Help" "Help"
Key names on Linux (GTK)
keysyms Gecko Requires Gecko 23.0 Gecko (with new WD, plan)
GDK_BackSpace "Backspace" "Backspace"
GDK_Tab "Tab" "Tab"
GDK_Linefeed "Unidentified" "Unidentified"
GDK_Clear "Clear" "Clear"
GDK_Return "Enter" "Enter"
GDK_Pause "Pause" "Pause"
GDK_Scroll_Lock "ScrollLock" "ScrollLock"
GDK_Sys_Req "PrintScreen" "PrintScreen"
GDK_Escape "Esc" "Escape"
GDK_Delete "Del" "Delete"
GDK_Multi_key "Compose" "Compose"
GDK_Codeinput (GDK_KEY_Hangul_Codeinput) "CodeInput" "CodeInput"
GDK_SingleCandidate (GDK_Kanji_Bangou, GDK_Hangul_SingleCandidate) "Unidentified" (Spec bug 21116) "SingleCandidate"
GDK_MultipleCandidate (GDK_Hangul_MultipleCandidate) "AllCandidates" "AllCandidates"
GDK_PreviousCandidate (GDK_Hangul_PreviousCandidate) "PreviousCandidate" "PreviousCandidate"
GDK_Kanji "KanjiMode" "KanjiMode"
GDK_Muhenkan "Nonconvert" "NonConvert"
GDK_Henkan_Mode "Unidentified" "Unidentified"
GDK_Henkan "Convert" "Convert"
GDK_Romaji "RomanCharacters" "RomanCharacters"
GDK_Hiragana "Hiragana" "Hiragana"
GDK_Katakana "Katakana" "Katakana"
GDK_Hiragana_Katakana "Unidentified" "HiraganaKatakana"
GDK_Zenkaku "FullWidth" "Zenkaku"
GDK_Hankaku "HalfWidth" "Hankaku"
GDK_Zenkaku_Hankaku "Unidentified" "ZenkakuHankaku"
GDK_Touroku "Unidentified" "Unidentified"
GDK_Massyo "Unidentified" "Unidentified"
GDK_Kana_Lock "KanaMode" "KanaMode"
GDK_Kana_Shift "KanaMode" "KanaMode"
GDK_Eisu_Shift "Alphanumeric" "Alphanumeric"
GDK_Eisu_toggle "Alphanumeric" "Alphanumeric"
GDK_Zen_Koho "Unidentified" "AllCandidates"
GDK_Mae_Koho "Unidentified" "PreviousCandidate"
GDK_Home "Home" "Home"
GDK_Left "Left" "ArrowLeft"
GDK_Up "Up" "ArrowUp"
GDK_Right "Right" "ArrowRight"
GDK_Down "Down" "ArrowDown"
GDK_Prior (GDK_Page_Up) "PageUp" "PageUp"
GDK_Next (GDK_Page_Down) "PageDown" "PageDown"
GDK_End "End" "End"
GDK_Begin "Unidentified" "Unidentified"
GDK_Select "Select" ? (Spec bug 23751)
GDK_Print "PrintScreen" "PrintScreen"
GDK_Execute "Execute" "Execute"
GDK_Insert "Insert" "Insert"
GDK_Undo "Undo" "Undo"
GDK_Redo "Unidentified" "Redo"
GDK_Menu "Menu" "ContextMenu"
GDK_Find "Find" "Find"
GDK_Cancel "Cancel" "Cancel"
GDK_Help "Help" "Help"
GDK_Break "Pause" "Pause"

GDK_Mode_switch (GDK_script_switch,
GDK_ISO_Group_Shift, GDK_kana_switch,
GDK_Arabic_switch, GDK_Greek_switch,
GDK_Hebrew_switch, GDK_Hangul_switch)

"AltGraph" "AltGraph"
GDK_Num_Lock "NumLock" "NumLock"
GDK_KP_Space "Spacebar" Actual input character. Requires Gecko 29.0
GDK_KP_Tab "Tab" "Tab"
GDK_KP_Enter "Enter" "Enter"
GDK_KP_F1 ~ GDK_KP_F4 "F1""F4" "F1""F4"
GDK_KP_Home "Home" "Home"
GDK_KP_Left "Left" "ArrowLeft"
GDK_KP_Up "Up" "ArrowUp"
GDK_KP_Right "Right" "ArrowRight"
GDK_KP_Down "Down" "ArrowDown"
GDK_KP_Prior (GDK_KP_Page_Up) "PageUp" "PageUp"
GDK_KP_Next (GDK_KP_Page_Down) "PageDown" "PageDown"
GDK_KP_End "End" "End"
GDK_KP_Begin "Unidentified" "Unidentified"
GDK_KP_Insert "Insert" "Insert"
GDK_KP_Delete "Del" "Delete"
GDK_KP_Equal "Equals" Actual input character. Requires Gecko 29.0
GDK_KP_Multiply "Multiply" Actual input character. Requires Gecko 29.0
GDK_KP_Add "Add" Actual input character. Requires Gecko 29.0
GDK_KP_Separator "Separator" Actual input character. Requires Gecko 29.0
GDK_KP_Subtract "Subtract" Actual input character. Requires Gecko 29.0
GDK_KP_Decimal "Decimal" Actual input character. Requires Gecko 29.0
GDK_KP_Divide "Divide" Actual input character. Requires Gecko 29.0
GDK_KP_0GDK_KP_9 Actual input character. Actual input character.
GDK_F1GDK_F10 "F1""F10" "F1""F10"
GDK_F11 (GDK_L1)GDK_F20 (GDK_L10) "F11""F20" "F11""F20"
GDK_F21 (GDK_R1)GDK_F35 (GDK_R15) "F21""F35" "F21""F35"
GDK_Shift_L "Shift" "Shift"
GDK_Shift_R "Shift" "Shift"
GDK_Control_L "Control" "Control"
GDK_Control_R "Control" "Control"
GDK_Caps_Lock "CapsLock" "CapsLock"
GDK_Shift_Lock "Shift" "Shift"
GDK_Meta_L "Meta" "Meta"
GDK_Meta_R "Meta" "Meta"
GDK_Alt_L "Alt" "Alt"
GDK_Alt_R "Alt" "Alt"
GDK_Super_L "OS" "Super"
GDK_Super_R "OS" "Super"
GDK_Hyper_L "OS" "Hyper"
GDK_Hyper_R "OS" "Hyper"
GDK_ISO_Lock "Unidentified" "Unidentified"
GDK_ISO_Level2_Latch "Unidentified" "Unidentified"
GDK_ISO_Level3_Shift "AltGraph" "AltGraph"
GDK_ISO_Level3_Latch "AltGraph" "AltGraph"
GDK_ISO_Level3_Lock "AltGraph" "AltGraph"
GDK_ISO_Level5_Shift "AltGraph" "AltGraph"
GDK_ISO_Level5_Latch "AltGraph" "AltGraph"
GDK_ISO_Level5_Lock "AltGraph" "AltGraph"
GDK_ISO_Group_Latch "Unidentified" (Spec bug 21140) "Unidentified"
GDK_ISO_Group_Lock "Unidentified" (Spec bug 21140) "Unidentified"
GDK_ISO_Next_Group "Unidentified" (Spec bug 21140) "GroupNext"
GDK_ISO_Next_Group_Lock "Unidentified" (Spec bug 21140) "GroupNext"
GDK_ISO_Prev_Group "Unidentified" (Spec bug 21140) "GroupPrevious"
GDK_ISO_Prev_Group_Lock "Unidentified" (Spec bug 21140) "GroupPrevious"
GDK_ISO_First_Group "Unidentified" (Spec bug 21140) "GroupFirst"
GDK_ISO_First_Group_Lock "Unidentified" (Spec bug 21140) "GroupFirst"
GDK_ISO_Last_Group "Unidentified" (Spec bug 21140) "GroupLast"
GDK_ISO_Last_Group_Lock "Unidentified" (Spec bug 21140) "GroupLast"
GDK_ISO_Left_Tab "Unidentified" "Unidentified"
GDK_ISO_Move_Line_Up "Unidentified" "Unidentified"
GDK_ISO_Move_Line_Down "Unidentified" "Unidentified"
GDK_ISO_Partial_Line_Up "Unidentified" "Unidentified"
GDK_ISO_Partial_Line_Down "Unidentified" "Unidentified"
GDK_ISO_Partial_Space_Left "Unidentified" "Unidentified"
GDK_ISO_Partial_Space_Right "Unidentified" "Unidentified"
GDK_ISO_Set_Margin_Left "Unidentified" "Unidentified"
GDK_ISO_Set_Margin_Right "Unidentified" "Unidentified"
GDK_ISO_Release_Margin_Left "Unidentified" "Unidentified"
GDK_ISO_Release_Margin_Right "Unidentified" "Unidentified"
GDK_ISO_Release_Both_Margins "Unidentified" "Unidentified"
GDK_ISO_Fast_Cursor_Left "Unidentified" "Unidentified"
GDK_ISO_Fast_Cursor_Right "Unidentified" "Unidentified"
GDK_ISO_Fast_Cursor_Up "Unidentified" "Unidentified"
GDK_ISO_Fast_Cursor_Down "Unidentified" "Unidentified"
GDK_ISO_Continuous_Underline "Unidentified" "Unidentified"
GDK_ISO_Discontinuous_Underline "Unidentified" "Unidentified"
GDK_ISO_Emphasize "Unidentified" "Unidentified"
GDK_ISO_Center_Object "Unidentified" "Unidentified"
GDK_ISO_Enter "Enter" "Enter"
GDK_First_Virtual_Screen "Unidentified" "Unidentified"
GDK_Prev_Virtual_Screen "Unidentified" "Unidentified"
GDK_Next_Virtual_Screen "Unidentified" "Unidentified"
GDK_Last_Virtual_Screen "Unidentified" "Unidentified"
GDK_Terminate_Server "Unidentified" "Unidentified"
GDK_AccessX_Enable "Unidentified" "Unidentified"
GDK_AccessX_Feedback_Enable "Unidentified" "Unidentified"
GDK_RepeatKeys_Enable "Unidentified" "Unidentified"
GDK_SlowKeys_Enable "Unidentified" "Unidentified"
GDK_BounceKeys_Enable "Unidentified" "Unidentified"
GDK_StickyKeys_Enable "Unidentified" "Unidentified"
GDK_MouseKeys_Enable "Unidentified" "Unidentified"
GDK_MouseKeys_Accel_Enable "Unidentified" "Unidentified"
GDK_Overlay1_Enable "Unidentified" "Unidentified"
GDK_Overlay2_Enable "Unidentified" "Unidentified"
GDK_AudibleBell_Enable "Unidentified" "Unidentified"
GDK_Pointer_* "Unidentified" "Unidentified"
GDK_ch "Unidentified" "Unidentified"
GDK_Ch "Unidentified" "Unidentified"
GDK_CH "Unidentified" "Unidentified"
GDK_c_h "Unidentified" "Unidentified"
GDK_C_h "Unidentified" "Unidentified"
GDK_C_H "Unidentified" "Unidentified"
GDK_3270_Duplicate "Unidentified" "Unidentified"
GDK_3270_FieldMark "Unidentified" "Unidentified"
GDK_3270_Right2 "Unidentified" "Unidentified"
GDK_3270_Left2 "Unidentified" "Unidentified"
GDK_3270_BackTab "Unidentified" "Unidentified"
GDK_3270_EraseEOF "EraseEof" "EraseEof"
GDK_3270_EraseInput "Unidentified" "Unidentified"
GDK_3270_Reset "Unidentified" "Unidentified"
GDK_3270_Quit "Unidentified" "Unidentified"
GDK_3270_PA1 "Unidentified" "Unidentified"
GDK_3270_PA2 "Unidentified" "Unidentified"
GDK_3270_PA3 "Unidentified" "Unidentified"
GDK_3270_Test "Unidentified" "Unidentified"
GDK_3270_Attn "Attn" "Attn"
GDK_3270_CursorBlink "Unidentified" "Unidentified"
GDK_3270_AltCursor "Unidentified" "Unidentified"
GDK_3270_KeyClick "Unidentified" "Unidentified"
GDK_3270_Jump "Unidentified" "Unidentified"
GDK_3270_Ident "Unidentified" "Unidentified"
GDK_3270_Rule "Unidentified" "Unidentified"
GDK_3270_Copy "Unidentified" "Unidentified"
GDK_3270_Play "Play" "Play"
GDK_3270_Setup "Unidentified" "Unidentified"
GDK_3270_Record "Unidentified" "Unidentified"
GDK_3270_ChangeScreen "Unidentified" "Unidentified"
GDK_3270_DeleteWord "Unidentified" "Unidentified"
GDK_3270_ExSelect "Exsel" "ExSel"
GDK_3270_CursorSelect "Crsel" "CrSel"
GDK_3270_PrintScreen "PrintScreen" "PrintScreen"
GDK_3270_Enter "Enter" "Enter"
GDK_space "Spacebar" Actual input character. Requires Gecko 29.0
GDK_Hangul "Unidentified" bug 865564 "Unidentified"
GDK_Hangul_Start "Unidentified" bug 865564 "Unidentified"
GDK_Hangul_End "Unidentified" bug 865564 "Unidentified"
GDK_Hangul_Hanja "Unidentified" bug 865564 "Unidentified"
GDK_Hangul_Jamo "Unidentified" bug 865564 "Unidentified"
GDK_Hangul_Romaja "Unidentified" bug 865564 "Unidentified"
GDK_Hangul_Jeonja "Unidentified" bug 865564 "Unidentified"
GDK_Hangul_Banja "Unidentified" bug 865564 "Unidentified"
GDK_Hangul_PreHanja "Unidentified" bug 865564 "Unidentified"
GDK_Hangul_PostHanja "Unidentified" bug 865564 "Unidentified"
GDK_ModeLock "Unidentified" "Unidentified"
GDK_MonBrightnessUp "BrightnessUp" "BrightnessUp"
GDK_MonBrightnessDown "BrightnessDown" "BrightnessDown"
GDK_KbdLightOnOff "Unidentified" "Unidentified"
GDK_KbdBrightnessUp "Unidentified" "Unidentified"
GDK_KbdBrightnessDown "Unidentified" "Unidentified"
GDK_Standby "Unidentified" (Spec bug 21118) "Standby"
GDK_AudioLowerVolume "VolumeDown" "VolumeDown"
GDK_AudioMute "VolumeMute" "VolumeMute"
GDK_AudioRaiseVolume "VolumeUp" "VolumeUp"
GDK_AudioPlay "MediaPlay" "MediaPlay"
GDK_AudioStop "MediaStop" "MediaStop"
GDK_AudioPrev "MediaPreviousTrack" "MediaTrackPrevious"
GDK_AudioNext "MediaNextTrack" "MediaTrackNext"
GDK_HomePage "BrowserHome" "BrowserHome"
GDK_Mail "LaunchMail" "LaunchMail"
GDK_Start "Unidentified" "Unidentified"
GDK_Search "BrowserSearch" "BrowserSearch"
GDK_AudioRecord "MediaRecord" "MediaRecord"
GDK_Calculator "Unidentified" (Spec bug 21134) "LaunchCalculator"
GDK_Memo "Unidentified" (Spec bug 21134) "Unidentified"
GDK_ToDoList "Unidentified" (Spec bug 21134) "Unidentified"
GDK_Calendar "Unidentified" (Spec bug 21134) "LaunchCalendar"
GDK_PowerDown "Unidentified" (Spec bug 21118) "PowerOff"
GDK_ContrastAdjust "Unidentified" "Unidentified"
GDK_RockerUp "Unidentified" "Unidentified"
GDK_RockerDown "Unidentified" "Unidentified"
GDK_RockerEnter "Unidentified" "Unidentified"
GDK_Back "BrowserBack" "BrowserBack"
GDK_Forward "BrowserForward" "BrowserForward"
GDK_Stop "BrowserStop" "BrowserStop"
GDK_Refresh "BrowserRefresh" "BrowserRefresh"
GDK_PowerOff "Power" "Power"
GDK_WakeUp "Unidentified" (Spec bug 21118) "WakeUp"
GDK_Eject "Eject" "Eject"
GDK_ScreenSaver "Unidentified" (Spec bug 21134) "LaunchScreenSaver"
GDK_WWW "Unidentified" (Spec bug 21134) "LaunchWebBrowser"
GDK_Sleep "Unidentified" (Spec bug 21118) "Standby"
GDK_Favorites "Unidentified" "Unidentified"
GDK_AudioPause "MediaPause" "MediaPause"
GDK_AudioMedia "Unidentified" "MediaApps"
GDK_MyComputer "Unidentified" (Spec bug 21134) "LaunchMyComputer"
GDK_VendorHome "Unidentified" (Spec bug 21134) "Unidentified"
GDK_LightBulb "Unidentified" "Unidentified"
GDK_Shop "Unidentified" (Spec bug 21134) "Unidentified"
GDK_History "Unidentified" "Unidentified"
GDK_OpenURL "Unidentified" (Spec bug 21134) "Unidentified"
GDK_AddFavorite "Unidentified" "Unidentified"
GDK_HotLinks "Unidentified" (Spec bug 21134) "Unidentified"
GDK_BrightnessAdjust "Dimmer" "Dimmer"
GDK_Finance "Unidentified" (Spec bug 21134) "Unidentified"
GDK_Community "Unidentified" (Spec bug 21134) "Unidentified"
GDK_AudioRewind "MediaRewind" "MediaRewind"
GDK_BackForward "Unidentified" "Unidentified"
GDK_Launch0 ~ GDK_Launch9 "LaunchApplication1""LaunchApplication10" "LaunchApplication1""LaunchApplication10"
GDK_LaunchA ~ GDK_LaunchF "LaunchApplication11""LaunchApplication16" "LaunchApplication11""LaunchApplication16"
GDK_ApplicationLeft "Unidentified" "Unidentified"
GDK_ApplicationRight "Unidentified" "Unidentified"
GDK_Book "Unidentified" (Spec bug 21134) "Unidentified"
GDK_CD "Unidentified" (Spec bug 21134) "LaunchMediaPlayer"
GDK_WindowClear "Unidentified" "Unidentified"
GDK_Close "Unidentified" (Spec bug 21143) "Close"
GDK_Copy "Copy" "Copy"
GDK_Cut "Cut" "Cut"
GDK_Display "Unidentified" "Unidentified"
GDK_DOS "Unidentified" (Spec bug 21134) "Unidentified"
GDK_Documents "Unidentified" (Spec bug 21134) "Unidentified"
GDK_Excel "Unidentified" (Spec bug 21134) "LaunchSpreadsheet"
GDK_Explorer "Unidentified" (Spec bug 21134) "LaunchMyComputer"
GDK_Game "Unidentified" (Spec bug 21134) "Unidentified"
GDK_Go "Unidentified" "Unidentified"
GDK_iTouch "Unidentified" "Unidentified"
GDK_LogOff "Unidentified" (Spec bug 21118) "LogOff"
GDK_Market "Unidentified" (Spec bug 21134) "Unidentified"
GDK_Meeting "Unidentified" (Spec bug 21134) "Unidentified"
GDK_MenuKB "Unidentified" "Unidentified"
GDK_MenuPB "Unidentified" "Unidentified"
GDK_MySites "Unidentified" "BrowserFavorites"
GDK_New "Unidentified" (Spec bug 21143) "New"
GDK_News "Unidentified" (Spec bug 21134) "Unidentified"
GDK_OfficeHome "Unidentified" (Spec bug 21134) "Unidentified"
GDK_Open "Unidentified" (Spec bug 21143) "Open"
GDK_Option "Unidentified" "Unidentified"
GDK_Paste "Paste" "Paste"
GDK_Phone "Unidentified" (Spec bug 21121) "Unidentified"
GDK_Reply "Unidentified" (Spec bug 21143) "MailReply"
GDK_Reload "BrowserRefresh" "BrowserRefresh"
GDK_RotateWindows "Unidentified" "Unidentified"
GDK_RotationPB "Unidentified" "Unidentified"
GDK_RotationKB "Unidentified" "Unidentified"
GDK_Save "Unidentified" (Spec bug 21143) "Save"
GDK_ScrollUp "Unidentified" "Unidentified"
GDK_ScrollDown "Unidentified" "Unidentified"
GDK_ScrollClick "Unidentified" "Unidentified"
GDK_Send "Unidentified" (Spec bug 21143) "MailSend"
GDK_Spell "Unidentified" (Spec bug 21143) "SpellCheck"
GDK_SplitScreen "Unidentified" "Unidentified"
GDK_Support "Unidentified" "Unidentified"
GDK_TaskPane "Unidentified" "Unidentified"
GDK_Terminal "Unidentified" "Unidentified"
GDK_Tools "Unidentified" "Unidentified"
GDK_Travel "Unidentified" "Unidentified"
GDK_UserPB "Unidentified" "Unidentified"
GDK_User1KB "Unidentified" "Unidentified"
GDK_User2KB "Unidentified" "Unidentified"
GDK_Video "Unidentified" (Spec bug 21134) "LaunchMediaPlayer"
GDK_WheelButton "Unidentified" "Unidentified"
GDK_Word "Unidentified" (Spec bug 21134) "LaunchWordProcessor"
GDK_Xfer "Unidentified" "Unidentified"
GDK_ZoomIn "Unidentified" (Spec bug 21119) "ZoomIn"
GDK_ZoomOut "Unidentified" (Spec bug 21119) "ZoomOut"
GDK_Away "Unidentified" "Unidentified"
GDK_Messenger "Unidentified" (Spec bug 21134) "Unidentified"
GDK_WebCam "Unidentified" (Spec bug 21134) "LaunchWebCam"
GDK_MailForward "Unidentified" (Spec bug 21143) "MailForward"
GDK_Pictures "Unidentified" (Spec bug 21134) "Unidentified"
GDK_Music "Unidentified" (Spec bug 21134) "LaunchMusicPlayer"
GDK_Battery "Unidentified" "Unidentified"
GDK_Bluetooth "Unidentified" "Unidentified"
GDK_WLAN "Unidentified" "Unidentified"
GDK_UWB "Unidentified" "Unidentified"
GDK_AudioForward "Unidentified" "MediaFastForward"
GDK_AudioRepeat "Unidentified" "Unidentified"
GDK_AudioRandomPlay "RandomToggle" "RandomToggle"
GDK_Subtitle "Subtitle" "Subtitle"
GDK_AudioCycleTrack "Unidentified" "MediaSkip"
GDK_CycleAngle "Unidentified" "Unidentified"
GDK_FrameBack "Unidentified" "Unidentified"
GDK_FrameForward "Unidentified" "Unidentified"
GDK_Time "Unidentified" "Unidentified"
GDK_SelectButton "Unidentified" (Spec bug 21137) "Unidentified"
GDK_View "Unidentified" "Unidentified"
GDK_TopMenu "Unidentified" "Unidentified"
GDK_Red "Red" "ColorF0Red"
GDK_Green "Green" "ColorF1Green"
GDK_Yellow "Yellow" "ColorF2Yellow"
GDK_Blue "Blue" "ColorF3Blue"
GDK_Suspend "Unidentified" (Spec bug 21118) "Standby"
GDK_Hibernate "Unidentified" (Spec bug 21118) "Hibernate"
GDK_TouchpadToggle "Unidentified" "Unidentified"
GDK_TouchpadOn "Unidentified" "Unidentified"
GDK_TouchpadOff "Unidentified" "Unidentified"
GDK_AudioMicMute "Unidentified" "Unidentified"
GDK_Switch_VT_1GDK_Switch_VT_12 "Unidentified" (Spec bug 23167) "Unidentified"
GDK_Ungrab "Unidentified" "Unidentified"
GDK_ClearGrab "Unidentified" "Unidentified"
GDK_Next_VMode "Unidentified" "VideoModeNext"
GDK_Prev_VMode "Unidentified" "Unidentified"
GDK_LogWindowTree "Unidentified" "Unidentified"
GDK_LogGrabInfo "Unidentified" "Unidentified"

Specification

DOM 3 Events: KeyboardEvent

Example

<!DOCTYPE html>
<html>
<head>
<script>
var metaChar = false;
var exampleKey = 16;

function keyEvent(event) {
  var key = event.keyCode || event.which;
  var keychar = String.fromCharCode(key);
  if (key == exampleKey) {
    metaChar = true;
  }
  if (key != exampleKey) {
    if (metaChar) {
      alert("Combination of metaKey + " + keychar);
      metaChar = false;
    } else {
      alert("Key pressed " + key);
    }
  }
}

function metaKeyUp (event) {
  var key = event.keyCode || event.which;

  if (key == exampleKey) {
    metaChar = false;
  }
}
</script>
</head>

<body onkeydown="keyEvent(event)" onkeyup="metaKeyUp(event)">
</body>
</html>
""""

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) (Yes) (Yes) (Yes) (Yes)
constructor (Yes) 31.0 (31.0) Not supported (Yes) ?
.char Not supported Not supported (Yes) Not supported Not supported
.charCode (Yes) (Yes) (Yes) (Yes) (Yes)
.isComposing Not supported 31.0 (31.0) Not supported Not supported Not supported
.key Not supported non-printable keys: 23.0 (23.0)
printable keys: 29.0 (29.0)
(Yes) Not supported Not supported
.keyCode (Yes) (Yes) (Yes) (Yes) (Yes)
.locale Not supported Not supported (Yes) Not supported Not supported
.location (Yes) 15.0 (15.0) (Yes) Not supported Not supported
.repeat Not supported 28.0 (28.0) (Yes) Not supported Not supported
.which (Yes) (Yes) (Yes) (Yes) (Yes)
.getModifierState() Not supported 15.0 (15.0) (Yes) Not supported Not supported
.initKeyboardEvent() (Yes) *1 31.0 (31.0) 9.0 *2 ? (Yes) *1
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support ? (Yes) ? ? ?
constructor ? 31.0 (31.0) ? ? ?
.char ? Not supported ? ? ?
.charCode ? (Yes) ? ? ?
.isComposing Not supported 31.0 (31.0) Not supported Not supported Not supported
.key ? non-printable keys: 23.0 (23.0)
printable keys: 29.0 (29.0)
? ? ?
.keyCode ? (Yes) ? ? ?
.locale ? Not supported ? ? ?
.location ? 15.0 (15.0) ? ? ?
.repeat ? 28.0 (28.0) ? ? ?
.which ? (Yes) ? ? ?
.getModifierState() ? 15.0 (15.0) ? ? ?
.initKeyboardEvent() ? 31.0 (31.0) ? ? ?


*1 The arguments of initKeyboardEvent() of WebKit and Blink's are different from the definition in DOM Level 3 Events. The method is: initKeyboardEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg,  in views::AbstractView viewArg, in DOMString keyIndentifierArg, in unsigned long locationArg, in boolean ctrlKeyArg, in boolean altKeyArg, in boolean shiftKeyArg, in boolean metaKeyArg, in boolean altGraphKeyArg)

*2 The argument of initKeyboardEvent() of IE is different from the definition in DOM Level 3 Events. The method is: initKeyboardEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg,  in views::AbstractView viewArg, in long detailArg, in DOMString keyArg, in unsigned long locationArg, in DOMString modifierListArg, in boolean repeatArt, in DOMString locationArg). See document of initKeyboardEvent() in MSDN.

Attachments

File Size Date Attached by
KB_United_States.svg
130165 bytes 2011-08-26 18:54:46 Sheppy
web-console-message-request
13571 bytes 2013-07-15 15:48:03 wbamberg

Document Tags and Contributors

Contributors to this page: Sheppy, WP-Makyen, Masayuki, MattBrubeck, ethertank, kscarfone, teoli
Last updated by: Masayuki,