The set of key codes which are currently depressed (down)
The set of movement keys which were recently pressed
StaticCONTROL_The OS-specific string display for what their Command key is
StaticKEYCODE_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.
StaticMODIFIER_Track which KeyboardEvent#code presses associate with each modifier.
StaticMODIFIER_Allowed modifier keys.
StaticPRINTABLE_Matches any single graphic Unicode code-point (letters, digits, punctuation, symbols, including emoji). Non-printable identifiers like ArrowLeft, ShiftLeft, Dead never match.
StaticPROTECTED_Key codes which are "protected" and should not be used because they are reserved for browser-level actions.
Determines whether an HTMLElement currently has focus, which may influence keybinding actions.
An element is considered to have focus if:
dataset.keyboardFocus attribute explicitly set to "true" or an empty string ("").<input>, <select>, or <textarea> element, all of which inherently accept keyboard input.isContentEditable property set to true, meaning it is an editable element.<button> element inside a <form>, which suggests interactive use.An element is considered not focused if:
document.activeElement is not an HTMLElement).dataset.keyboardFocus attribute explicitly set to "false".If none of these conditions are met, the element is assumed to be unfocused.
StaticisIs logical keybindings active?
InternalBegin listening to keyboard events.
Report whether a core action key is currently actively depressed.
The core action to verify (ex: "target")
Is this core action key currently down (active)?
Report whether a modifier in KeyboardManager.MODIFIER_KEYS is currently actively depressed.
A modifier in MODIFIER_KEYS
Is this modifier key currently down (active)?
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.
Optionaloptions: { force?: boolean } = {}Options to configure behavior.
Optionalforce?: booleanForce the keyup events to be handled.
Protected_onProtectedRelease any down keys when focusing a form element.
The focus event.
Protected_processProtectedProcesses a keyboard event context, checking it against registered keybinding actions
The keyboard event context
Optionaloptions: { force?: boolean } = {}Additional options to configure behavior.
Optionalforce?: booleanForce the event to be handled.
Static_getInternalGiven a keyboard-event context, return every registered keybinding that matches it (may be empty).
StaticemulateEmulates 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
Optionaloptions: {Additional options to configure behavior.
OptionalaltKey?: booleanEmulate the ALT modifier as pressed
OptionalctrlKey?: booleanEmulate the CONTROL modifier as pressed
Optionalforce?: booleanForce the event to be handled.
Optionalrepeat?: booleanEmulate this as a repeat event
OptionalshiftKey?: booleanEmulate the SHIFT modifier as pressed
StaticgetGet 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
StaticgetFormat a KeyboardEvent#code into a displayed string.
The input code
The displayed string for this code
StatictranslateCanonical identifier for a key press.
A set of helpers and management functions for dealing with user input from keyboard events. https://keycode.info/
See
foundry.Game#keyboard