Lynx

KeyEvent

Represents a keyboard event, inherited from Event, which describes the user's interaction with the keyboard. Each event describes a single interaction between the user and a key, or a key combined with modifier keys.

Instance property

key

key: string;

Represents the value of the physical key pressed by the user.

repeat

repeat: boolean;

true indicates the key is being held down such that it is automatically repeating.

altKey

altKey: boolean;

true indicates the Alt key, or Option () on macOS, was active when the key event was generated.

ctrlKey

ctrlKey: boolean;

true indicates the Ctrl key was active when the key event was generated.

metaKey

metaKey: boolean;

true indicates the Meta key was active when the key event was generated. On macOS, this is the Command () key. On Windows, this is the Windows key.

shiftKey

shiftKey: boolean;

true indicates the Shift key was active when the key event was generated.

KeyEvent type

keydown

Indicates that a key has been pressed.

keyup

Indicates that a key has been released.

Compatibility

LCD tables only load in the browser

Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.