Re: [w3c/editing] VirtualKeyboardAPI spec draft (#309)

@yoavweiss commented on this pull request.



> +                attribute EventHandler ongeometrychange;
+            };
+        </pre>
+        <dl>
+            <dt>
+                <dfn>show()</dfn> method
+            </dt>
+              <dd>
+                <p>
+                  The method must follow these steps:
+                </p>
+                <ol>
+                  <li>If the <a>document</a> doesn't have <a href="https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation">sticky user activation</a>, abort these steps.
+
+                  </li>
+                  <li>Trigger {{VirtualKeyboard/show()}} call that invokes a system API to show the VK.

That seems kinda circular. It'd be good to define what the call actually does.

> +                undefined hide();
+                readonly attribute DOMRect boundingRect;
+                attribute boolean overlaysContent;
+                attribute EventHandler ongeometrychange;
+            };
+        </pre>
+        <dl>
+            <dt>
+                <dfn>show()</dfn> method
+            </dt>
+              <dd>
+                <p>
+                  The method must follow these steps:
+                </p>
+                <ol>
+                  <li>If the <a>document</a> doesn't have <a href="https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation">sticky user activation</a>, abort these steps.

If I'm reading the sticky activation algorithm correctly, it applies to a Window object, not a Document.

> +                  </li>
+                  <li>Trigger {{VirtualKeyboard/show()}} call that invokes a system API to show the VK.
+                  </li>
+                </ol>
+               </dd>
+            <dt>
+                <dfn>hide()</dfn> method
+            </dt>
+              <dd>
+                <p>
+                  The method must follow these steps:
+                </p>
+                <ol>
+                  <li>If the <a>document</a> doesn't have <a href="https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation">sticky user activation</a>, abort these steps.
+                  </li>
+                  <li>Trigger {{VirtualKeyboard/hide()}}call that invokes a system API to hide the keyboard.

Same comments as above

> +              <dd>
+                <p>
+                  The method must follow these steps:
+                </p>
+                <ol>
+                  <li>If the <a>document</a> doesn't have <a href="https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation">sticky user activation</a>, abort these steps.
+                  </li>
+                  <li>Trigger {{VirtualKeyboard/hide()}}call that invokes a system API to hide the keyboard.
+                  </li>
+                </ol>
+               </dd>
+               <p class="note">
+                Platform heuristics may impose additional restrictions on VK {{VirtualKeyboard/show()}} and {{VirtualKeyboard/hide()}}.
+              </p>
+              <p class="note">
+                A few people have expressed concerns around {{VirtualKeyboard/show()}} and {{VirtualKeyboard/hide()}} methods not being promise-based. However, we couldn't find any real use cases around needing promises in this type of operation.

Examples below are showing them returning a Promise. Would be good to clarify which variant is implemented.

> +                  <li>Trigger {{VirtualKeyboard/hide()}}call that invokes a system API to hide the keyboard.
+                  </li>
+                </ol>
+               </dd>
+               <p class="note">
+                Platform heuristics may impose additional restrictions on VK {{VirtualKeyboard/show()}} and {{VirtualKeyboard/hide()}}.
+              </p>
+              <p class="note">
+                A few people have expressed concerns around {{VirtualKeyboard/show()}} and {{VirtualKeyboard/hide()}} methods not being promise-based. However, we couldn't find any real use cases around needing promises in this type of operation.
+              </p>
+            <dt>
+              <dfn>overlaysContent</dfn>
+            </dt>
+            <dd>
+              <p>
+                The attribute enables the author to opt-out of resizing the visual viewport.

Would be good to define a setter that impacts the processing and does the actual opt-out.

> +                A few people have expressed concerns around {{VirtualKeyboard/show()}} and {{VirtualKeyboard/hide()}} methods not being promise-based. However, we couldn't find any real use cases around needing promises in this type of operation.
+              </p>
+            <dt>
+              <dfn>overlaysContent</dfn>
+            </dt>
+            <dd>
+              <p>
+                The attribute enables the author to opt-out of resizing the visual viewport.
+              </p>
+            </dd>
+            <dt>
+              <dfn>boundingRect</dfn>
+            </dt>
+            <dd>
+            <p>
+                The attribute reports the intersection of the VK with the layout viewport in client coordinates.

You should define a getter that defines what's returned here

> +                  The event is dispatched when the intersection of the VK and the layout viewport changes, e.g. in response to the VK being shown or hidden or the browser window being repositioned.
+              </p>
+              </dd>
+        </dl>
+    </section>
+    <section data-dfn-for="ElementContentEditable">
+        <h2>Extensions to the <dfn>ElementContentEditable</dfn> mixin</h2>
+        <pre class="idl">
+           partial interface ElementContentEditable {
+            [CEReactions, Reflect, ReflectOnly=("auto","manual")] 
+            attribute DOMString virtualKeyboardPolicy;
+           };
+        </pre>
+        <p>The <dfn><code>virtualKeyboardPolicy</code></dfn> is an <a href=https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute>enumerated attribute</a> whose keywords are the empty string, auto, and manual.
+        <p>When specified on an element that is a contenteditable host, <dfn><code>auto</code></dfn> causes the corresponding editable element to automatically show the VK when it is focused or tapped & <dfn><code>manual</code></dfn> 
+            decouples focus and tap on the editable element from changes in the VK’s current state - the VK remains as it was.

Similarly to the above, you probably want to define the processing for this attribute: what happens when it's set, changed, removed, etc.

> +        </h2>
+        <p>
+          The {{VirtualKeyboard}} API proposes six new <a href="https://drafts.csswg.org/css-env-1/#environment">CSS environment variables</a> that the web developers can utilize to calculate the virtual keyboard's size and adjust layout in a declarative way.
+        </p>
+        <p class="note">
+          These CSS env should be added to the <a href="https://drafts.csswg.org/css-env-1/#env-function">CSS env variable spec</a>.
+        </p>
+        <section>
+            <h3>Keyboard inset variables</h3>
+            <table data-for="env()">
+                <tr>
+                    <th>Name
+                    <th>Value
+                <tr>
+                    <td><dfn>keyboard-inset-top</dfn>
+                    <td><a href="https://drafts.csswg.org/css-values-3/#length-valuehttps://drafts.csswg.org/css-values-3/#length-value"> length</a>

You probably want to define the semantics of each of these variables and what its value is set to.

> +                attribute EventHandler ongeometrychange;
+            };
+        </pre>
+        <dl>
+            <dt>
+                <dfn>show()</dfn> method
+            </dt>
+              <dd>
+                <p>
+                  The method must follow these steps:
+                </p>
+                <ol>
+                  <li>If the <a>document</a> doesn't have <a href="https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation">sticky user activation</a>, abort these steps.
+
+                  </li>
+                  <li>Trigger {{VirtualKeyboard/show()}} call that invokes a system API to show the VK.

For example, I'm guessing it's impacting `boundingRect` in some way.

> +                attribute EventHandler ongeometrychange;
+            };
+        </pre>
+        <dl>
+            <dt>
+                <dfn>show()</dfn> method
+            </dt>
+              <dd>
+                <p>
+                  The method must follow these steps:
+                </p>
+                <ol>
+                  <li>If the <a>document</a> doesn't have <a href="https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation">sticky user activation</a>, abort these steps.
+
+                  </li>
+                  <li>Trigger {{VirtualKeyboard/show()}} call that invokes a system API to show the VK.

Similarly, it probably fires the `geometrychange` event at some point.

> +                attribute EventHandler ongeometrychange;
+            };
+        </pre>
+        <dl>
+            <dt>
+                <dfn>show()</dfn> method
+            </dt>
+              <dd>
+                <p>
+                  The method must follow these steps:
+                </p>
+                <ol>
+                  <li>If the <a>document</a> doesn't have <a href="https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation">sticky user activation</a>, abort these steps.
+
+                  </li>
+                  <li>Trigger {{VirtualKeyboard/show()}} call that invokes a system API to show the VK.

It might be best to define the processing of what happens when the virtual keyboard is displayed and folded and then hook into that processing from these explicit methods, but also from places where the UA can decide to do that automatically (e.g. from editable content when it's getting focus)

> +                undefined hide();
+                readonly attribute DOMRect boundingRect;
+                attribute boolean overlaysContent;
+                attribute EventHandler ongeometrychange;
+            };
+        </pre>
+        <dl>
+            <dt>
+                <dfn>show()</dfn> method
+            </dt>
+              <dd>
+                <p>
+                  The method must follow these steps:
+                </p>
+                <ol>
+                  <li>If the <a>document</a> doesn't have <a href="https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation">sticky user activation</a>, abort these steps.

It would be good to clarify which Document (or Window) we're talking about

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing/pull/309#pullrequestreview-692783230

Received on Friday, 25 June 2021 13:06:44 UTC