KeyboardEvent Interface
Deprecated
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.
KeyboardEvent
interface is deprecated in DOM Level 3 in favor of the new TextInput
interface and the corresponding textinput
event, which have improved support for alternate input methods. However, DOM Level 3 textinput
events are not yet implemented in Gecko (as of version 6.0), so code written for Gecko browsers should continue to use KeyboardEvent
for now.Extends
Methods
Code void initKeyboardEvent(String type, bool canBubble, bool cancelable, Window view, String keyIdentifier, int keyLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey) #
Initializes the attributes of a keyboard event object.
Parameters
typeArg
- The type of keyboard event; this will be one of
keydown
,keypress
, orkeyup
. 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.
localeArg
- The value of the locale attribute.
void initKeyboardEvent(String type, bool canBubble, bool cancelable, Window view, String keyIdentifier, int keyLocation, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey);
Fields
Code final bool altKey #
true
if the Alt (or Option, on Mac) key was active when the key event was generated. Read only.
final bool altKey;
Code final bool ctrlKey #
true
if the Control key was active when the key event was generated. Read only.
final bool ctrlKey;
Code final bool metaKey #
true
if the Meta (or Command, on Mac) key was active when the key event was generated. Read only.
final bool metaKey;
Code final bool shiftKey #
true
if the Shift key was active when the key event was generated. Read only.
final bool shiftKey;
This page includes content from the Mozilla Foundation that is graciously licensed under a Creative Commons: Attribution-Sharealike license. Mozilla has no other association with Dart or dartlang.org. We encourage you to improve the web by contributing to The Mozilla Developer Network.