Skip to content

Latest commit

 

History

History
157 lines (113 loc) · 10.7 KB

File metadata and controls

157 lines (113 loc) · 10.7 KB

Virtual Keyboard Control

Note - this proposal extends the scope of VirtualKeyboard Interface

Status of this Document

This document is intended as a starting point for engaging the community and standards bodies in developing collaborative solutions fit for standardization. As the solutions to problems described in this document progress along the standards-track, we will retain this document as an archive and use this section to keep the community up-to-date with the most current standards venue and content location of future work and discussions.

Introduction

The Virtual Keyboard (VK) is the on-screen keyboard used for input in scenarios where a hardware keyboard may not be available. Unlike a hardware keyboard, a VK can adapt its shape to optimize for the expected type of input.

Example of a standard keyboard Example of a number keyboard

Authors have control over the displayed shape of the VK through the inputmode attribute, but have limited control over when the VK is shown or hidden.

This document proposes a new API surface to provide authors with more control over when the VK is shown or hidden.

Background and Motivating Scenarios

Inputmode conflates two aspects of the VK that should be separated: its visibility and its layout.

To control the shape of the VK, authors can use the inputmode attribute. inputmode accepts the following keywords:

Keyword Purpose
none Hide the keyboard if it is currently showing.
text Display a keyboard layout specialized for text input.
tel Display a keyboard layout specialized for telephone number input
url Display a keyboard layout specialized for url input
email Display a keyboard layout specialized for email input
numeric Display a keyboard layout specialized for number input
decimal Display a keyboard layout specialized for fractional numeric input
search Display a keyboard layout specialized for search

The value of none is special in that it controls not the appearance but the behavior of the virtual keyboard (hide if currently shown). On the Windows platform, however, the user has the ability to reveal the keyboard manually using a button in the UI of the task bar. task bar

If an author doesn’t want to show the VK when an editable element is focused, but wants to ensure that the keyboard appears with its numeric layout if manually revealed by the user, this cannot be accomplished; inputmode can only be one of none or numeric at any moment in time.

A mode should exist that allows an editable element to be focused while the VK remains as it was.

Additionally, there is no mechanism for an app to simply leave the VK in its current state when an editable element is focused. The values of inputmode only allow: none - which will hide the VK when focused, and all other values - which show the VK when focused.

Previous Focused Element Next Focused Element Behavior of Virtual Keyboard
editable, inputmode="text" editable, inputmode="none" A VK was showing, but then is hidden
editable, inputmode="none" editable, inputmode="text" A VK was hidden, but then is shown