-
Notifications
You must be signed in to change notification settings - Fork 757
Description
On many devices, user agents have interactive overlay widgets to assist users when interacting with web pages. The most common is a virtual keyboard, which allows users on touch devices (mobile, tablet and touch-enabled laptops) to type input that is equivalent to that coming from a keyboard.
These interactive widgets typically overlap the web page's viewport, and hence there is a question of whether the viewport should resize to account for their presence.
Currently, most mobile browsers on Android (Chrome and Firefox in particular) resize the initial containing block (ICB) while the virtual keyboard is open. iOS browsers do not, and instead ovelay the virtual keyboard on top of the scrollable content of the web page without causing a change to layout. Chrome on ChromeOS has the same behavior as iOS. See here for many more details and a complete analysis of how it all works.
There are valid use cases for resizing the ICB (e.g. it provides a convenient way for mobile PWAs to keep informational/actionable bottom-bars or buttons visible on the screen while the virtual keyboard is open), and for not (in many cases, it's undesirable for UX or performance to not affect layout). Developers have also filed CSSWG (example) and browser bug issues (example) requesting both behaviors.
I propose we extend the viewport <meta> tag to opt into different behaviors. An example syntax would be:
<meta name="viewport" content="width=device-width, initial-scale=1.0, virtual-keyboard=resize-layout">
(resize-visual and overlays-content would also be options; the former is iOS and ChromeOS, and the latter aligns with behavior of the virtual keyboard API).
See here for more details.
We might want to pick a more general name than virtual-keyboard to be forward compatible with other interactive overlays that may be added in the future.
I think resize-visual should be the default.
Metadata
Metadata
Assignees
Type
Projects
Status
Status