Keyboard Class
The keyboard of a window (https://wicg.github.io/keyboard-lock/#keyboard-interface, navigator.keyboard): the Keyboard Lock API, which captures the keys that the system or the browser handle, with KeyboardLockOptions. A document whose keyboard is locked is not kept in the back/forward cache (as in Chromium).
public sealed class Keyboard : EventTarget- Inheritance
EventTargetKeyboard
Properties
| Name | Description |
|---|---|
| OnLayoutChange | Gets or sets the event handler of the layoutchange event, fired when the keyboard layout changes. |
OnLayoutChange
KeyboardMap.csGets or sets the event handler of the layoutchange event, fired when the keyboard layout changes.
Property value
See also
Methods
| Name | Description |
|---|---|
| GetLayoutMap() | Returns the keyboard layout of the device (https://wicg.github.io/keyboard-map/#h-keyboard-getlayoutmap), read from KeyboardMapOptions.Provider (US QWERTY by default). The calls made before the task completes return the same task (as in Chromium). The task fails with a SecurityError DomException when the document is not allowed to use the keyboard-map feature, and an InvalidStateError when it is not fully active. |
| Lock(IReadOnlyList<string>?) | Captures the keys that the system or the browser handle (https://wicg.github.io/keyboard-lock/#h-keyboard-lock), with KeyboardLockOptions.Lock. The task fails with an InvalidStateError DomException when the document is not the active document of a top-level browsing context, an InvalidAccessError when a key code is not valid, and an AbortError when another call replaces the request before it completes. |
| Unlock() | Releases the keys captured by Keyboard.Lock (https://wicg.github.io/keyboard-lock/#h-keyboard-unlock), with KeyboardLockOptions.Unlock. |
GetLayoutMap()
KeyboardMap.csReturns the keyboard layout of the device (https://wicg.github.io/keyboard-map/#h-keyboard-getlayoutmap), read from KeyboardMapOptions.Provider (US QWERTY by default). The calls made before the task completes return the same task (as in Chromium). The task fails with a SecurityError DomException when the document is not allowed to use the keyboard-map feature, and an InvalidStateError when it is not fully active.
public Task<KeyboardLayoutMap> GetLayoutMap()Lock(IReadOnlyList<string>?)
KeyboardLock.csCaptures the keys that the system or the browser handle (https://wicg.github.io/keyboard-lock/#h-keyboard-lock), with KeyboardLockOptions.Lock. The task fails with an InvalidStateError DomException when the document is not the active document of a top-level browsing context, an InvalidAccessError when a key code is not valid, and an AbortError when another call replaces the request before it completes.
public Task Lock(IReadOnlyList<string>? keyCodes = null)Parameters
keyCodesIReadOnlyList<string>?- The
codevalues of the keys to capture, or an empty list to capture all the keys.
Returns
See also
Unlock()
KeyboardLock.csReleases the keys captured by Keyboard.Lock (https://wicg.github.io/keyboard-lock/#h-keyboard-unlock), with KeyboardLockOptions.Unlock.
public void Unlock()