Intent to Prototype: VirtualKeyboard API

Skip to first unread message

Anupam Snigdha

Apr 21, 2020, 10:56:42 PM4/21/20
to blink-dev, Bo Cupp, Grisha Lyukshin, Mustaq Ahmed


Contact emails,, 



The two explainers above were developed in parallel and describe two aspects of the same interface:VirtualKeyboard, which we intend to prototype.


Design doc


TAG review



The new VirtualKeyboard interface enables authors to:

  • Request that the VK be hidden or shown
  • Monitor when the VK (in a docked state) is shown or hidden
  • Monitor the size and position of the VK
  • Opt-out of having the visual viewport resized when a docked VK is shown or hidden



See the explainers for motivating scenarios.



Interoperability and Compatibility

This API allows sites that want fine-grained control over their editing and input experience to progressively enhance how users interact with their site on touch-first devices using the VK.

The new API can be feature-detected by checking for the existence of the virtualKeyboard property on the navigator object.


Edge: Public support

Chrome: Public support

Firefox: No signals

Safari: No signals

Web / Framework developers: Support from Google docs discussing the needs of the site and here is an existing bug.

Github issues:



Are there any other platform APIs this feature will frequently be used in tandem with? 


Could the default usage of this API make it hard for Chrome to maintain good performance (i.e. synchronous return, must run on a certain thread, guaranteed return timing)?




Will it be challenging for developers to take advantage of this feature immediately, as-is?


Would this feature benefit from having polyfills, significant documentation and outreach, and/or libraries built on top of it to make it easier to use?

No, as the web APIs need to interact with system VK APIs which is currently not possible through JS.



These APIs are just a trigger for the system VK APIs so currently there is no support for web developers to debug system VK APIs through dev-tools.  No specialized debugging experience is currently envisioned.


Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

No.  This API is appropriate for touch-first devices such as phones and tablets where the on-screen keyboard is the primary input method. Windows, Android and Chrome OS are candidates.


We are seeking collaborators with platform expertise to help with non-Windows implementations.


Link to entry on the feature dashboard


Requesting approval to ship?



Ashley Gullen

Apr 22, 2020, 11:49:58 AM4/22/20
to Anupam Snigdha, blink-dev, Bo Cupp, Grisha Lyukshin, Mustaq Ahmed
For years we've struggled with the way the OSK resizes the page on Android, rather than merely overlaying the keyboard and scrolling the page to center on the input field as it does on iOS. There are long-standing bugs associated with this, e.g. and

The new overlaysContent looks like it will solve this by opting in to the iOS behavior, which is great. Can you confirm that this option will result in the behavior we get on iOS?

You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Anupam Snigdha

Apr 22, 2020, 12:42:51 PM4/22/20
to Ashley Gullen, Anupam Snigdha, blink-dev, Bo Cupp, Grisha Lyukshin, Mustaq Ahmed
The bugs you linked talk about visual viewport getting resized and the edit controls not scrolling into view properly. This feature is opt-in and it doesn't resize the visual viewport or scroll the edit controls into view if the overlaysContent flag is set. The web authors have to handle the scrolling and re-flowing the content themselves if it is occluded by the VK. This is especially useful when there are multiple screens and browser's default scrolling and resizing doesn't meet the expectations of the web authors. 


Ojan Vafai

May 17, 2020, 4:14:57 PM5/17/20
to Anupam Snigdha, Ashley Gullen, Anupam Snigdha, blink-dev, Bo Cupp, Grisha Lyukshin, Mustaq Ahmed
I'm excited to see these features come out! There's a significant historical quirk that this API could trivially address around programmatic focus. 

From the explainer: "auto causes the corresponding editable element to automatically show the VK when it is focused or tapped (current behavior); manual decouples focus and taps on the editable element from changes in the VK’s current state - the VK remains as it was."

In Chrome, programmatically applied focus (.focus() or autofocus) doesn't show the keyboard if the user has never clicked on the page. This is a pretty bad user and developer experience because they get a focused input, with a blinking cursor, and no keyboard. This was added very very early in the life of Chrome's first mobile release because the New York Times had an "autofocus" attribute on their search bar, which meant you'd get a keyboard on every article load.

Ideally, we'd just remove that heuristic entirely now. The web has considerably broader mobile-optimized content now. I highly suspect this hack isn't needed at all anymore. But a passable, zero risk fallback would be that supplying any "virtualkeyboardpolicy" disables this heuristic. Then at least there would be *some* way to work around this as a web author.

FWIW, this is a bug that's currently affecting my email client. I have an android home screen shortcut to compose a new message. I autofocus the subject line so you can immediately start typing, but I get a blinking cursor and no keyboard. The net effect is that I always have to click the screen a second time in order to show the keyboard because I chose to build on the web. :(

Reply all
Reply to author
0 new messages