VirtualKeyboard Class

The on-screen keyboard of a window (https://w3c.github.io/virtual-keyboard/#the-virtualkeyboard-interface, navigator.virtualKeyboard): it is shown and hidden with VirtualKeyboardOptions, and its geometry is read from the VirtualKeyboardProvider of the browsing context. Only the top-level documents get the geometry of the keyboard; the rectangle of the documents of the nested browsing contexts stays empty.

public sealed class VirtualKeyboard : EventTarget
Inheritance
EventTarget VirtualKeyboard

Properties

NameDescription
BoundingRectGets the intersection of the keyboard with the viewport of the document, in client coordinates.
OnGeometryChangeGets or sets the event handler of the geometrychange event.
OverlaysContentGets or sets whether the keyboard overlays the content: the viewport is not resized when the keyboard is shown, and the keyboard-inset-* environment variables give its geometry. It can only be set in a top-level browsing context.

BoundingRect

VirtualKeyboard.cs

Gets the intersection of the keyboard with the viewport of the document, in client coordinates.

public DomRect BoundingRect { get; }

OnGeometryChange

VirtualKeyboard.cs

Gets or sets the event handler of the geometrychange event.

public Action<Event>? OnGeometryChange { get; set; }

OverlaysContent

VirtualKeyboard.cs

Gets or sets whether the keyboard overlays the content: the viewport is not resized when the keyboard is shown, and the keyboard-inset-* environment variables give its geometry. It can only be set in a top-level browsing context.

public bool OverlaysContent { get; set; }

Methods

NameDescription
Hide()Hides the on-screen keyboard (https://w3c.github.io/virtual-keyboard/#dom-virtualkeyboard-hide), with VirtualKeyboardOptions.Hide.
Show()Shows the on-screen keyboard (https://w3c.github.io/virtual-keyboard/#dom-virtualkeyboard-show), with VirtualKeyboardOptions.Show.

Hides the on-screen keyboard (https://w3c.github.io/virtual-keyboard/#dom-virtualkeyboard-hide), with VirtualKeyboardOptions.Hide.

public void Hide()

Shows the on-screen keyboard (https://w3c.github.io/virtual-keyboard/#dom-virtualkeyboard-show), with VirtualKeyboardOptions.Show.

public void Show()