Intent to Prototype: VirtualKeyboard API

499 views
Skip to first unread message

Anupam Snigdha

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

 

Contact emails

sni...@microsoft.com, pc...@microsoft.com, gl...@microsoft.com 

 

Explainers

https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/VirtualKeyboardPolicy/explainer.md

https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/VirtualKeyboardAPI/explainer.md

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

 

Design doc

https://docs.google.com/document/d/1I0LUNxK_gP5IaNQsbYN6gL6Zpm71XzduCKkublU5o5Q/edit?usp=sharing

 

TAG review

https://github.com/w3ctag/design-reviews/issues/498

https://github.com/w3ctag/design-reviews/issues/507

 

Summary

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

 

Motivation

See the explainers for motivating scenarios.

 

Risks

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: https://github.com/whatwg/html/issues/4896

 

Ergonomics

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

No.

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)?

No.

 

Activation

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

No.

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.

 

Debuggability

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

https://www.chromestatus.com/feature/5680057076940800

 

Requesting approval to ship?

No.

 

Ashley Gullen

unread,
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. crbug.com/404315 and crbug.com/490618.

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 blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/SN2PR00MB00934435C1DE1ABA33572F78CFD20%40SN2PR00MB0093.namprd00.prod.outlook.com.

Anupam Snigdha

unread,
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. 

-Anupam

Ojan Vafai

unread,
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
Forward
0 new messages