Skip to content

Commit c0dd898

Browse files
authored
[css-viewport-1] Add 'interactive-widgets' to viewport meta (w3c#7826)
This describes the `interactive-widgets` property of the viewport meta tag for describing the expected behavior when a virtual-keyboard-like widget is shown.
1 parent 0742ad6 commit c0dd898

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

css-viewport/Overview.bs

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ Issue Tracking: CSSWG GitHub https://github.com/w3c/csswg-drafts/labels/css-view
1919
Ignored Vars: <viewport-length>
2020
</pre>
2121

22+
<pre class="anchors">
23+
spec: virtual-keyboard; urlPrefix: https://w3c.github.io/virtual-keyboard
24+
type: interface; text: VirtualKeyboard; url: dom-virtualkeyboard
25+
type: attribute; text: overlaysContent; for: VirtualKeyboard; url: dom-virtualkeyboard-overlayscontent
26+
</pre>
27+
2228

2329
<h2 id="intro">
2430
Introduction</h2>
@@ -125,6 +131,7 @@ The recognized properties in the viewport
125131
<li><code class="index">minimum-scale</code></li>
126132
<li><code class="index">maximum-scale</code></li>
127133
<li><code class="index">user-scalable</code></li>
134+
<li><code class="index">interactive-widget</code></li>
128135
</ul>
129136

130137
<h3 id="parsing-algorithm">
@@ -260,6 +267,83 @@ as follows:
260267

261268
Issue: Specify extend-to-zoom behavior by the viewport meta tag
262269

270+
<h3 id="interactive-widget-section">''interactive-widget''</h3>
271+
272+
Issue: Move the definition of ''visual viewport'' from CSSOM-View to this spec.
273+
274+
The <dfn><code>interactive-widget</code></dfn> property specifies the effect that interactive UI
275+
widgets have on the page's viewports. It defines whether widgets overlay a given viewport or whether
276+
the viewport is shrunken so that it remains fully visible while the widget is showing. Interactive
277+
UI widgets are transient user agent or operating system UI through which a user can provide input.
278+
279+
<div class="note">The most common such UI widget is a virtual keyboard.</div>
280+
281+
The following is a list of valid values for [=interactive-widget=] and the associated
282+
viewport-resizing behavior:
283+
284+
<dl>
285+
<dt><dfn><code>overlays-content</code></dfn></dt>
286+
<dd>
287+
Interactive UI widgets MUST NOT [=resize=] the [=initial viewport=] nor
288+
the <a spec="CSSOM-VIEW">visual viewport</a>. The user agent must perform the same steps
289+
as when {{VirtualKeyboard/overlaysContent|VirtualKeyboard.overlaysContent}} is set to
290+
<code>true</code>.
291+
</dd>
292+
<dt><dfn><code>resizes-content</code></dfn></dt>
293+
<dd>
294+
Interactive UI widgets MUST [=resize=] the [=initial viewport=] by the interactive widget.
295+
</dd>
296+
<div class="note">
297+
Since the <a spec="CSSOM-VIEW">visual viewport</a>'s size is derived from the
298+
[=initial viewport=], [=resizes-content=] will cause a resize of both the initial and visual
299+
viewports.
300+
</div>
301+
<dt><dfn><code>resizes-visual</code></dfn></dt>
302+
<dd>
303+
Interactive UI widgets MUST [=resize=] the <a spec="CSSOM-VIEW">visual viewport</a> but MUST
304+
NOT [=resize=] the <a spec="CSS-VIEWPORT">initial viewport</a>.
305+
</dd>
306+
</dl>
307+
308+
If no value, or an invalid value, is set for [=interactive-widget=], the behavior implied by
309+
[=resizes-visual=] is used as the default.
310+
311+
To <dfn lt="resize">resize a viewport by an interactive widget</dfn>, subtract from it the
312+
intersection of the viewport rect with the widget's OS reported bounding rect. In cases where this
313+
would result in a non-rectangular viewport, the behavior is user agent defined.
314+
315+
<div class="note">
316+
Some examples where the result would non rectangular: a
317+
<a href="https://support.apple.com/en-ca/HT207521">floating or split keyboard</a>, or a keyboard that
318+
<a href="https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/VirtualKeyboardAPI/explainer.md#motivation">
319+
occupies only part</a> of the viewport.
320+
</div>
321+
322+
<h4 id="interaction-with-virtualkeyboard-overlayscontent">
323+
Interaction with virtualKeyboard.overlaysContent
324+
</h4>
325+
326+
[[!VIRTUAL-KEYBOARD]] provides an imperitive API to apply the [=overlays-content=] behavior via
327+
the {{VirtualKeyboard/overlaysContent|VirtualKeyboard.overlaysContent}} attribute. This attribute
328+
shadows the value set to [=interactive-widget=], namely:
329+
330+
When {{VirtualKeyboard/overlaysContent|VirtualKeyboard.overlaysContent}} is set to
331+
<code>true</code>, the UA MUST ignore any value set to [=interactive-widget=] when determining the
332+
resizing behavior of interactive widgets.
333+
334+
When {{VirtualKeyboard/overlaysContent|VirtualKeyboard.overlaysContent}} is set to
335+
<code>false</code>, the UA MUST use the value set to [=interactive-widget=], or the default behavior
336+
if a value is not set, when determining the resizing behavior of interactive widgets.
337+
338+
Getting the value of {{VirtualKeyboard/overlaysContent|VirtualKeyboard.overlaysContent}} MUST return
339+
only the value previously set to it.
340+
341+
<div class="note">
342+
That is, unless previously set, <code>VirtualKeyboard.overlaysContent</code> returns false
343+
even if <code>interactive-widget=overlays-content</code> is set via the <code>&ltmeta&gt</code>
344+
tag.
345+
</div>
346+
263347
<pre class=biblio>
264348
{
265349
"Algorithms": {

0 commit comments

Comments
 (0)