Defines the keycode values for keys that are returned by KeyboardEvent.keyCode.
Important note: There is substantial divergence in how different browsers handle keycodes and their variants in different locales/keyboard layouts. We provide these constants to help make code processing keys more readable.
Constants
- A → int
-
65
- ALT → int
-
18
- APOSTROPHE → int
-
CAUTION: This constant requires localization for other locales and keyboard layouts.
192
- B → int
-
66
- BACKSLASH → int
-
CAUTION: This constant requires localization for other locales and keyboard layouts.
220
- BACKSPACE → int
-
8
- C → int
-
67
- CAPS_LOCK → int
-
20
- CLOSE_SQUARE_BRACKET → int
-
CAUTION: This constant requires localization for other locales and keyboard layouts.
221
- COMMA → int
-
CAUTION: This constant requires localization for other locales and keyboard layouts.
188
- CONTEXT_MENU → int
-
93
- CTRL → int
-
17
- D → int
-
68
- DASH → int
-
CAUTION: This constant requires localization for other locales and keyboard layouts.
189
- DELETE → int
-
46
- DOWN → int
-
40
- E → int
-
69
- EIGHT → int
-
56
- END → int
-
35
- ENTER → int
-
13
- EQUALS → int
-
CAUTION: This constant requires localization for other locales and keyboard layouts.
187
- ESC → int
-
27
- F → int
-
70
- F1 → int
-
112
- F2 → int
-
113
- F3 → int
-
114
- F4 → int
-
115
- F5 → int
-
116
- F6 → int
-
117
- F7 → int
-
118
- F8 → int
-
119
- F9 → int
-
120
- F10 → int
-
121
- F11 → int
-
122
- F12 → int
-
123
- FF_EQUALS → int
-
61
- FF_SEMICOLON → int
-
59
- FIRST_MEDIA_KEY → int
-
166
- FIVE → int
-
53
- FOUR → int
-
52
- G → int
-
71
- H → int
-
72
- HOME → int
-
36
- I → int
-
73
- INSERT → int
-
45
- J → int
-
74
- K → int
-
75
- L → int
-
76
- LAST_MEDIA_KEY → int
-
183
- LEFT → int
-
37
- M → int
-
77
- MAC_ENTER → int
-
3
- MAC_FF_META → int
-
224
- META → int
-
91
- N → int
-
78
- NINE → int
-
57
- NUM_CENTER → int
-
NUM_CENTER is also NUMLOCK for FF and Safari on Mac.
12
- NUM_DELETE → int
-
46
- NUM_DIVISION → int
-
111
- NUM_EAST → int
-
39
- NUM_EIGHT → int
-
104
- NUM_FIVE → int
-
101
- NUM_FOUR → int
-
100
- NUM_INSERT → int
-
45
- NUM_MINUS → int
-
109
- NUM_MULTIPLY → int
-
106
- NUM_NINE → int
-
105
- NUM_NORTH → int
-
38
- NUM_NORTH_EAST → int
-
33
- NUM_NORTH_WEST → int
-
36
- NUM_ONE → int
-
97
- NUM_PERIOD → int
-
110
- NUM_PLUS → int
-
107
- NUM_SEVEN → int
-
103
- NUM_SIX → int
-
102
- NUM_SOUTH → int
-
40
- NUM_SOUTH_EAST → int
-
34
- NUM_SOUTH_WEST → int
-
35
- NUM_THREE → int
-
99
- NUM_TWO → int
-
98
- NUM_WEST → int
-
37
- NUM_ZERO → int
-
96
- NUMLOCK → int
-
144
- O → int
-
79
- ONE → int
-
49
- OPEN_SQUARE_BRACKET → int
-
CAUTION: This constant requires localization for other locales and keyboard layouts.
219
- P → int
-
80
- PAGE_DOWN → int
-
34
- PAGE_UP → int
-
33
- PAUSE → int
-
19
- PERIOD → int
-
CAUTION: This constant requires localization for other locales and keyboard layouts.
190
- PRINT_SCREEN → int
-
44
- Q → int
-
81
- QUESTION_MARK → int
-
CAUTION: The question mark is for US-keyboard layouts. It varies for other locales and keyboard layouts.
63
- R → int
-
82
- RIGHT → int
-
39
- S → int
-
83
- SCROLL_LOCK → int
-
145
- SEMICOLON → int
-
CAUTION: This constant requires localization for other locales and keyboard layouts.
186
- SEVEN → int
-
55
- SHIFT → int
-
16
- SINGLE_QUOTE → int
-
CAUTION: This constant requires localization for other locales and keyboard layouts.
222
- SIX → int
-
54
- SLASH → int
-
CAUTION: This constant requires localization for other locales and keyboard layouts.
191
- SPACE → int
-
32
- T → int
-
84
- TAB → int
-
9
- THREE → int
-
51
- TILDE → int
-
CAUTION: This constant requires localization for other locales and keyboard layouts.
192
- TWO → int
-
50
- U → int
-
85
- UNKNOWN → int
-
A sentinel value if the keycode could not be determined.
-1
- UP → int
-
38
- V → int
-
86
- W → int
-
87
- WIN_IME → int
-
229
- WIN_KEY → int
-
224
- WIN_KEY_FF_LINUX → int
-
0
- WIN_KEY_LEFT → int
-
91
- WIN_KEY_RIGHT → int
-
92
- X → int
-
88
- Y → int
-
89
- Z → int
-
90
- ZERO → int
-
48
Static Methods
-
isCharacterKey(
int keyCode) → bool -
Returns true if the keyCode produces a (US keyboard) character. Note: This does not (yet) cover characters on non-US keyboards (Russian, Hebrew, etc.).
Constructors
- KeyCode()
Properties
- hashCode → int
-
The hash code for this object.
read-only, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
toString(
) → String -
Returns a string representation of this object.
inherited