Private
domThe list of HTML DOM elements bound to this keyboard driver and their event listeners
Check if the currently focused root needs keyboard input. Virtual keyboard should query this property to know when to show themselves.
Private
addAdd pointer event listeners to DOM element.
Bind an HTML DOM element to this keyboard driver.
If the root was already bound, removeListeners is called, replacing the old listeners. Populates domElems with the new bind.
If true, event listeners will be added to listen for keys. blur event listeners are always added no matter what.
Protected
changeChanges the current root focus.
If there was a previous root focus, that root's clearFocus is called with Keyboard.
keysDown is cleared.
Clear the current root focus. Calls changeFocusedRoot with null.
Similar to getFocusedRoot, but can fall back to lastActivity if focus is null, or a Root in eventQueues if lastActivity is also null.
Must follow the KeyboardEvent.key Web API.
Push a new KeyPress event to eventQueues.
Must follow the KeyboardEvent.key Web API.
Is shift being pressed?
Is control being pressed?
Is alt being pressed?
Calls keyDown followed by keyUp. If the key was already down before calling (isKeyDown), keyUp is not called.
Must follow the KeyboardEvent.key Web API.
Is shift being pressed?
Is control being pressed?
Is alt being pressed?
Push a new KeyRelease event to eventQueues.
Must follow the KeyboardEvent.key Web API.
Is shift being pressed?
Is control being pressed?
Is alt being pressed?
Removes disabled root from eventQueues. If the root was the focus, then the focus is cleared.
Adds enabled root to eventQueues.
Does nothing if the new focus type is not a Keyboard. If the focus comes from a root which is not the root focus, then the root focus is changed to the new root. If there is no new focused widget (the root's keyboard focus was cleared), then nothing happens.
This behaviour is confusing, however, it's required so that the keyboard focus "lingers" for future tab key presses; this way, pressing tab can do tab selection even when there is no widget that wants keyboard input. When a focus is lingering, then it means that key events are still being dispatched to the last focused root, but they don't have a target. This way, most events get dropped, but tab key events are used for tab selection.
Private
removeRemove event listeners from DOM element and unset tracked listeners in bind.
Check if the root focus should be cleared given that the HTML DOM focus has been lost to another HTML DOM element
The HTML DOM element to which the focus has been lost to
Dispatches all queued events for the root and clears its event queue
Generated using TypeDoc
A KeyboardDriver which listens for key events from HTML DOM elements.
Note that if a DOM element is unfocused in the DOM to an unbound DOM element, the root focus is cleared. If this creates issues, other DOM elements can be bound without listening for key events.