KeyboardEvent class

objects describe a user interaction with the keyboard; each event describes a single interaction between the user and a key (or combination of a key with modifier keys) on the keyboard. The event type (keydown, keypress, or keyup) identifies what kind of keyboard activity occurred.

Note: events just indicate what interaction the user had with a key on the keyboard at a low level, providing no contextual meaning to that interaction. When you need to handle text input, use the input event instead. Keyboard events may not be fired if the user is using an alternate means of entering text, such as a handwriting system on a tablet or graphics tablet.

Event

UIEvent

KeyboardEvent

Implemented types
Available extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

KeyboardEvent(String type, [KeyboardEventInit? eventInitDict])
factory

Properties

altKey bool

Available on KeyboardEvent, provided by the PropsKeyboardEvent extension

no setter
bubbles bool

Available on Event, provided by the PropsEvent extension

no setter
cancelable bool

Available on Event, provided by the PropsEvent extension

no setter
cancelBubble bool

Available on Event, provided by the PropsEvent extension

getter/setter pair
charCode int

Available on KeyboardEvent, provided by the PropsKeyboardEvent extension

no setter
code String

Available on KeyboardEvent, provided by the PropsKeyboardEvent extension

no setter
composed bool

Available on Event, provided by the PropsEvent extension

no setter
ctrlKey bool

Available on KeyboardEvent, provided by the PropsKeyboardEvent extension

no setter
currentTarget EventTarget?

Available on Event, provided by the PropsEvent extension

no setter
defaultPrevented bool

Available on Event, provided by the PropsEvent extension

no setter
detail int

Available on UIEvent, provided by the PropsUIEvent extension

no setter
eventPhase int

Available on Event, provided by the PropsEvent extension

no setter
hashCode int
The hash code for this object.
no setterinherited
isComposing bool

Available on KeyboardEvent, provided by the PropsKeyboardEvent extension

no setter
isTrusted bool

Available on Event, provided by the PropsEvent extension

no setter
key String

Available on KeyboardEvent, provided by the PropsKeyboardEvent extension

no setter
keyCode int

Available on KeyboardEvent, provided by the PropsKeyboardEvent extension

no setter
location int

Available on KeyboardEvent, provided by the PropsKeyboardEvent extension

no setter
metaKey bool

Available on KeyboardEvent, provided by the PropsKeyboardEvent extension

no setter
repeat bool

Available on KeyboardEvent, provided by the PropsKeyboardEvent extension

no setter
returnValue ↔ dynamic

Available on Event, provided by the PropsEvent extension

getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shiftKey bool

Available on KeyboardEvent, provided by the PropsKeyboardEvent extension

no setter
sourceCapabilities InputDeviceCapabilities?

Available on UIEvent, provided by the PropsUIEvent extension

no setter
srcElement EventTarget?

Available on Event, provided by the PropsEvent extension

no setter
target EventTarget?

Available on Event, provided by the PropsEvent extension

no setter
timeStamp double

Available on Event, provided by the PropsEvent extension

no setter
type String

Available on Event, provided by the PropsEvent extension

no setter
view Window?

Available on UIEvent, provided by the PropsUIEvent extension

no setter
which int

Available on UIEvent, provided by the PropsUIEvent extension

no setter

Methods

composedPath() Iterable<EventTarget>

Available on Event, provided by the PropsEvent extension

getModifierState(String keyArg) bool

Available on KeyboardEvent, provided by the PropsKeyboardEvent extension

initEvent(String type, [bool? bubbles = false, bool? cancelable = false]) → void

Available on Event, provided by the PropsEvent extension

initKeyboardEvent(String typeArg, [bool? bubblesArg = false, bool? cancelableArg = false, Window? viewArg, String? keyArg = '', int? locationArg = 0, bool? ctrlKey = false, bool? altKey = false, bool? shiftKey = false, bool? metaKey = false]) → void

Available on KeyboardEvent, provided by the PropsKeyboardEvent extension

initUIEvent(String typeArg, [bool? bubblesArg = false, bool? cancelableArg = false, Window? viewArg, int? detailArg = 0]) → void

Available on UIEvent, provided by the PropsUIEvent extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
preventDefault() → void

Available on Event, provided by the PropsEvent extension

stopImmediatePropagation() → void

Available on Event, provided by the PropsEvent extension

stopPropagation() → void

Available on Event, provided by the PropsEvent extension

toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

domKeyLocationLeft int
no setter
domKeyLocationNumpad int
no setter
domKeyLocationRight int
no setter
domKeyLocationStandard int
no setter