The set of key codes which are currently depressed (down)
The set of movement keys which were recently pressed
Static
MODIFIER_Allowed modifier keys
Static
MODIFIER_Track which KeyboardEvent#code presses associate with each modifier
Static
PROTECTED_Key codes which are "protected" and should not be used because they are reserved for browser-level actions.
Static
CONTROL_The OS-specific string display for what their Command key is
Static
KEYCODE_A special mapping of how special KeyboardEvent#code values should map to displayed strings or symbols. Values in this configuration object override any other display formatting rules which may be applied.
Test whether an HTMLElement currently has focus. If so we normally don't want to process keybinding actions.
Emulate a key-up event for any currently down keys. When emulating, we go backwards such that combinations such as "CONTROL + S" emulate the "S" first in order to capture modifiers.
Optional
options: { Options to configure behavior.
Force the keyup events to be handled.
Input events do not fire with isComposing = false at the end of a composition event in Chrome See: https://github.com/w3c/uievents/issues/202
Protected
_processProtected
Processes a keyboard event context, checking it against registered keybinding actions
The keyboard event context
Optional
options: { Additional options to configure behavior.
Force the event to be handled.
Protected
_onPrivate
_resetPrivate
_handleStatic
emulateEmulates a key being pressed, triggering the Keyboard event workflow.
If True, emulates the keyup
Event. Else, the keydown
event
The KeyboardEvent#code which is being pressed
Optional
options: { Additional options to configure behavior.
Emulate the ALT modifier as pressed
Emulate the CONTROL modifier as pressed
Emulate the SHIFT modifier as pressed
Emulate this as a repeat event
Force the event to be handled.
Static
getStatic
getGet a standardized keyboard context for a given event. Every individual keypress is uniquely identified using the KeyboardEvent#code property. A list of possible key codes is documented here: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values
The originating keypress event
A flag for whether the key is down or up
The standardized context of the event
Static
_getStatic
Private
_getPrivate
Converts a Keyboard Context event into a string representation, such as "C" or "Control+C"
The standardized context of the event
If True, includes modifiers in the string representation
Static
Private
_testPrivate
Test whether a keypress context matches the registration for a keybinding action
The keybinding action
The keyboard event context
Does the context match the action requirements?
Static
Private
_executePrivate
Given a registered Keybinding Action, executes the action with a given event and context
The registered Keybinding action to execute
The gathered context of the event
Returns true if the keybind was consumed
A set of helpers and management functions for dealing with user input from keyboard events. https://keycode.info/