KeyboardLayoutProvider Class

The source of the keyboard layout of the device (https://wicg.github.io/keyboard-map/), read by navigator.keyboard.getLayoutMap() in the browsing contexts that share a BrowsingContextOptions (KeyboardMapOptions.Provider). The default implementation returns KeyboardLayoutProvider.Layout, set by the application. Override KeyboardLayoutProvider.GetLayout to read another source, and call KeyboardLayoutProvider.OnLayoutChanged when the layout changes, to fire the layoutchange event of the Keyboard objects of the documents.

public class KeyboardLayoutProvider

Remarks

A provider can be shared by several browsing contexts, and used from any thread.

Constructors

NameDescription
KeyboardLayoutProvider()

KeyboardLayoutProvider()

KeyboardMap.cs
public KeyboardLayoutProvider()

No documentation is available.

Properties

NameDescription
LayoutGets or sets the layout returned by the default implementation of KeyboardLayoutProvider.GetLayout: the key value (e.g. q) produced without modifier by each key, by code value (e.g. KeyQ). Only the writing system keys are reported to the documents. The default is KeyboardLayoutProvider.UsQwerty. Setting it fires the layoutchange event of the Keyboard objects of the documents.
UsQwertyGets the US QWERTY layout: the key produced without modifier by each writing system key (https://w3c.github.io/uievents-code/#key-alphanumeric-writing-system) of a US keyboard, by code value.

Gets or sets the layout returned by the default implementation of KeyboardLayoutProvider.GetLayout: the key value (e.g. q) produced without modifier by each key, by code value (e.g. KeyQ). Only the writing system keys are reported to the documents. The default is KeyboardLayoutProvider.UsQwerty. Setting it fires the layoutchange event of the Keyboard objects of the documents.

public IReadOnlyDictionary<string, string> Layout { get; set; }

Gets the US QWERTY layout: the key produced without modifier by each writing system key (https://w3c.github.io/uievents-code/#key-alphanumeric-writing-system) of a US keyboard, by code value.

public static IReadOnlyDictionary<string, string> UsQwerty { get; }

Methods

NameDescription
GetLayout()Returns the current layout of the keyboard: the key value produced without modifier by each key, by code value.
OnLayoutChanged()Notifies the documents that the layout changed: their Keyboard objects fire the layoutchange event (a hidden document gets it when it becomes visible). It can be called from any thread.

GetLayout()

KeyboardMap.cs

Returns the current layout of the keyboard: the key value produced without modifier by each key, by code value.

public virtual IReadOnlyDictionary<string, string> GetLayout()

OnLayoutChanged()

KeyboardMap.cs

Notifies the documents that the layout changed: their Keyboard objects fire the layoutchange event (a hidden document gets it when it becomes visible). It can be called from any thread.

protected void OnLayoutChanged()

Events

NameDescription
LayoutChangedRaised when the layout changes (KeyboardLayoutProvider.OnLayoutChanged).

LayoutChanged

Raised when the layout changes (KeyboardLayoutProvider.OnLayoutChanged).

public event EventHandler? LayoutChanged