VirtualKeyboard: boundingRect property

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The boundingRect property of the VirtualKeyboard interface contains a DOMRect indicating the position and size of the on-screen virtual keyboard that overlays the web page.

The on-screen virtual keyboard will overlay the viewport when the Virtual Keyboard API is used to prevent the browser from resizing the viewport automatically. This is done by setting the overlaysContent property to true.


A DOMRect which indicates the position and size of the virtual keyboard in the viewport.

The x, y, width, and height coordinates of the rectangle are useful to reposition content in the webpage that needs to be visible even when the virtual keyboard is displayed.

const { x, y, width, height } = navigator.virtualKeyboard.boundingRect;


VirtualKeyboard API
# dom-virtualkeyboard-boundingrect

Browser compatibility

BCD tables only load in the browser

See also