Microsoft and Google are working on a new API for Chromium-based browsers like Chrome and Edge called “VirtualKeyboard” that updates the on-screen keyboard for typing on Windows, macOS, Chrome OS and Android and provides better control.
According to the documentation, Virtual Keyboard (VK) is a public JavaScript API that puts control of the on-screen keyboard in the hands of Web developers. As it stands now, developers have very limited control over VK, and the keyboard’s performance is not ideal for scenarios where developers want users to use a website’s built-in keyboard to enter passwords on Android.
Microsoft and Google are working on a new feature that will handle hiding/showing the keyboard and controlling whether the Visual Viewport resizes when the virtual keyboard changes visibility. In theory, the VirtualKeyboard API will provide developers with more control over when the virtual keyboard is shown or hidden.
The API affects triggering events, describes the intersection of VK and layout Viewport, and allows the browser to opt out of resizing its visual Viewport in response to changes in VK visibility," Microsoft said.
Unlike a Web browser or Web application, a native Android or Windows application supports listening to events from the operating system. By leveraging this new API, developers bring an enhanced experience to the Web on both desktop and mobile. As a result, editable areas of the site will always be visible.
Developers can also choose to include a new style where the docked virtual keyboard will overlay the content and developers will be able to optimize the layout Viewport for the virtual keyboard. for example, when the virtual keyboard appears on a cell phone, the browser will not scroll the editable elements into view and will not adjust the visual/layout Viewport when the overlayscontent flag is set to match the size of the new window.
Microsoft has confirmed that the updated API will support browsers on touch platforms with virtual keyboards, including Windows, Chrome OS and Android, and will not be available for Mac, Linux or Android WebView.
According to Google’s status page, Chrome will receive support for the VirtualKeyboard API for desktop and mobile version 94.
In addition, Chrome will also offer a built-in screenshot tool and other improvements in the next update.