HTML virtualkeyboardpolicy Global Attribute
The virtualkeyboardpolicy attribute sets whether the on-screen keyboard opens automatically when an editable element is focused (auto) or only from script (manual).
Description
The virtualkeyboardpolicy global attribute controls whether the on-screen virtual keyboard opens automatically when an editable element (an <input>, a <textarea> or an element with contenteditable) receives focus.
With auto (or an empty value), which is the default, the browser shows the keyboard when the element is focused or tapped. With manual, focusing the element does not show the keyboard; the page decides when to show and hide it with the VirtualKeyboard API, navigator.virtualKeyboard.show() and hide(). This is useful for editors or games that want to show their own controls first, or to open the keyboard only on a double tap.
<div contenteditable virtualkeyboardpolicy="manual" id="editor"></div>
<script>
editor.addEventListener("dblclick", () => navigator.virtualKeyboard.show());
</script>
The attribute is supported in Chromium-based browsers and has no effect on devices without a virtual keyboard.
Syntax
<element virtualkeyboardpolicy="auto | manual">
Values
- autoThe browser shows the virtual keyboard automatically when the element is focused or tapped. This is the default, and an empty value has the same meaning.
- manualThe keyboard is not shown automatically; use
navigator.virtualKeyboard.show()andhide().
Example
Browser Support
The following information will show you the current browser support for the HTML virtualkeyboardpolicy global attribute. Hover over a browser icon to see the version that first introduced support for this HTML global attribute.
Desktop





Tablets & Mobile





