-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Address VK spec review comments. #317
Conversation
There are some ReSpec errors related to |
Line 43 should be "geometry-1" instead, since that's what specref recognizes. @sidvishnoi, do you know why that difference happens, since https://respec.org/xref shows "geometry" instead? |
(While you are at it, could you please remove line 46 and replace line 6 to refer to respec-w3c instead?) |
@saschanaz That fixed the |
Reflect/ReflectOnly have never been defined in any spec, see whatwg/html#3238. I recommend to follow what WICG/attribution-reporting-api#67 says until it resolves.
|
docs/virtualkeyboard/index.html
Outdated
@@ -167,15 +166,24 @@ <h2>The <dfn>VirtualKeyboard</dfn> Interface</h2> | |||
</dt> | |||
<dd> | |||
<p> | |||
When this attribute is set to `true`, a user agent MUST NOT resize its layout viewport or visual viewport. | |||
A boolean, initially false. When this attribute is set to `true`, a user agent MUST NOT resize its layout viewport or visual viewport. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
false => false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@saschanaz https://respec.org/xref (xref UI) makes use of data from webref, while respec uses specref. Filed speced/respec-web-services#224, though it's probably something that specref needs to update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments
docs/virtualkeyboard/index.html
Outdated
@@ -119,7 +118,7 @@ <h2>The <dfn>VirtualKeyboard</dfn> Interface</h2> | |||
The method must follow these steps: | |||
</p> | |||
<ol> | |||
<li>If the browsing context's <a href="https://html.spec.whatwg.org/multipage/browsers.html#active-window">active window</a> does not have <a href="https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation">sticky user activation</a>, abort these steps. | |||
<li>If the <a href="https://heycam.github.io/webidl/#this">this's </a><a href="https://html.spec.whatwg.org/#concept-relevant-global">relevant global object</a> is a <a href="https://html.spec.whatwg.org/multipage/window-object.html#window">Window object</a> and does not have <a href="https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation">sticky user activation</a>, abort these steps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The links could use cross-references
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the" is not needed before this
. The "'s" following this
would be better outside the link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be called from a worker? If not, it's better to put this's relevant global in a variable, assert that it's a Window, and then abort if there's no user activation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docs/virtualkeyboard/index.html
Outdated
@@ -131,7 +130,7 @@ <h2>The <dfn>VirtualKeyboard</dfn> Interface</h2> | |||
Call the system API to show the VK. | |||
</li> | |||
<li> | |||
When the VK is shown by the system, fire {{VirtualKeyboard/ongeometrychange()}} event. | |||
When the VK is shown by the system, the OS reports the bounding rectangle of the keyboard. Calculate the {{VirtualKeyboard/boundingRect}} which is the intersection of the keyboard rectangle reported by the OS and the layout viewport. Fire {{VirtualKeyboard/ongeometrychange()}} event to JS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be good to define what a "bounding rectangle" is. https://drafts.csswg.org/cssom-view/#dom-element-getboundingclientrect outlines an algorithm that calculates one. It'd be good to have a similar processing model here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Calculate..." should call an algorithm that actually does this calculation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step should run in parallel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docs/virtualkeyboard/index.html
Outdated
@@ -143,7 +142,7 @@ <h2>The <dfn>VirtualKeyboard</dfn> Interface</h2> | |||
The method must follow these steps: | |||
</p> | |||
<ol> | |||
<li>If the browsing context is not focused, abort these steps. | |||
<li>If the <a href="https://heycam.github.io/webidl/#this">this's </a><a href="https://html.spec.whatwg.org/#concept-relevant-global">relevant global object</a> is a <a href="https://html.spec.whatwg.org/multipage/window-object.html#window">Window object</a> and does not have <a href="https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation">sticky user activation</a>, abort these steps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comments as above. May be useful to pack this in a helper algorithm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just couple of algorithm steps so didn't create a helper
docs/virtualkeyboard/index.html
Outdated
A boolean, initially false. When this attribute is set to `true`, a user agent MUST NOT resize its layout viewport or visual viewport. | ||
</p> | ||
<p> | ||
The {{VirtualKeyboard/overlaysContent}} getter steps are to return <a href="https://heycam.github.io/webidl/#this">this's </a>{{VirtualKeyboard/overlaysContent}}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be better to set and get a separate internal boolean variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you give me an example? I'm following https://xhr.spec.whatwg.org/#dom-xmlhttprequest-timeout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a second look, this is fine as is. It'd have been slightly better to define the getter as a separate concept, but that's not critical.
@yoavweiss Addressed all comments. PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more comments
docs/virtualkeyboard/index.html
Outdated
Let `lv` be the layout viewport's bounds in CSS pixels. | ||
</li> | ||
<li> | ||
Set [=this=]'s {{VirtualKeyboard/boundingRect}} to be the intersection of `lv` and `osk` in CSS pixels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This algorithm feels like a getter, rather than a setter. If so, it should return a DOMRect
but it doesn't create one. I'd expect it to do so while initializing it to the right values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a DOMRect
object to store the intersection of the rectangles.
docs/virtualkeyboard/index.html
Outdated
</dt> | ||
<dd> | ||
<p> | ||
The attribute reports the intersection of the VK with the layout viewport in client coordinates. | ||
The attribute reports the intersection of the VK with the layout viewport in client coordinates. It is set when {{VirtualKeyboard/ongeometrychange}} event is fired. | ||
Setter steps are as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no setter for a readonly attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, you are right. I'll remove it
docs/virtualkeyboard/index.html
Outdated
</li> | ||
</li> | ||
<li> | ||
When the VK is hidden by the system, the OS reports the bounding rectangle of the keyboard (which has all 0 values). Calculate the {{VirtualKeyboard/boundingRect}} which is the intersection of the keyboard rectangle reported by the OS and the layout viewport. Fire {{VirtualKeyboard/ongeometrychange()}} event to JS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Calculate ...." should call an algorithm, or simply assign a 0 sized DOMRect
(since that's the intersection IIUC)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/virtualkeyboard/index.html
Outdated
@@ -131,7 +130,7 @@ <h2>The <dfn>VirtualKeyboard</dfn> Interface</h2> | |||
Call the system API to show the VK. | |||
</li> | |||
<li> | |||
When the VK is shown by the system, fire {{VirtualKeyboard/ongeometrychange()}} event. | |||
When the VK is shown by the system, the OS reports the bounding rectangle of the keyboard. Calculate the {{VirtualKeyboard/boundingRect}} which is the intersection of the keyboard rectangle reported by the OS and the layout viewport. Fire {{VirtualKeyboard/ongeometrychange()}} event to JS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Calculate..." should call an algorithm that actually does this calculation.
docs/virtualkeyboard/index.html
Outdated
@@ -131,7 +130,7 @@ <h2>The <dfn>VirtualKeyboard</dfn> Interface</h2> | |||
Call the system API to show the VK. | |||
</li> | |||
<li> | |||
When the VK is shown by the system, fire {{VirtualKeyboard/ongeometrychange()}} event. | |||
When the VK is shown by the system, the OS reports the bounding rectangle of the keyboard. Calculate the {{VirtualKeyboard/boundingRect}} which is the intersection of the keyboard rectangle reported by the OS and the layout viewport. Fire {{VirtualKeyboard/ongeometrychange()}} event to JS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step should run in parallel
docs/virtualkeyboard/index.html
Outdated
@@ -116,7 +126,11 @@ <h2>The <dfn>VirtualKeyboard</dfn> Interface</h2> | |||
The method must follow these steps: | |||
</p> | |||
<ol> | |||
<li>If the browsing context's <a href="https://html.spec.whatwg.org/multipage/browsers.html#active-window">active window</a> does not have <a href="https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation">sticky user activation</a>, abort these steps. | |||
<li> | |||
Let `window` be [=this=]'s <a href="https://html.spec.whatwg.org/#concept-relevant-global">relevant global object</a>. If window is not a <a href="https://html.spec.whatwg.org/multipage/window-object.html#window">Window object</a>, then abort these steps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the window
variable should be referred to as "|window|".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@yoavweiss Addressed all comments. PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting closer... A few more comments
docs/virtualkeyboard/index.html
Outdated
</p> | ||
<dfn>overlaysContent</dfn> | ||
<p> | ||
A boolean, initially `false`. When this attribute is set to `true`, a user agent MUST NOT resize its layout viewport or <a href="https://wicg.github.io/visual-viewport/#dom-visualviewport">visual viewport</a>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IntersectionObserver uses the "document's viewport", pointing to https://drafts.csswg.org/css2/#viewport
That seems more precise than "layout viewport".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docs/virtualkeyboard/index.html
Outdated
@@ -116,7 +126,11 @@ <h2>The <dfn>VirtualKeyboard</dfn> Interface</h2> | |||
The method must follow these steps: | |||
</p> | |||
<ol> | |||
<li>If the browsing context's <a href="https://html.spec.whatwg.org/multipage/browsers.html#active-window">active window</a> does not have <a href="https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation">sticky user activation</a>, abort these steps. | |||
<li> | |||
Let |window| be [=this=]'s <a href="https://html.spec.whatwg.org/#concept-relevant-global">relevant global object</a>. If |window| is not a <a href="https://html.spec.whatwg.org/multipage/window-object.html#window">Window object</a>, then abort these steps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can replace the abort with an assertion that |window| is a [=Window=] (because this is only exposed on Window)
Nit: You can replace the explicit links (here and elsewhere) with spec references. e.g. "Let |window| be [=this=]'s [=relevant global object=]. Assert that |window| is a {{Window}} object."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docs/virtualkeyboard/index.html
Outdated
The attribute reports the intersection of the VK with the layout viewport in client coordinates. It is set when {{VirtualKeyboard/ongeometrychange}} event is fired. To create a {{VirtualKeyboard/boundingRect}} follow these steps: | ||
<ol> | ||
<li> | ||
Let `osk` be the on-screen keyboard rectangle in CSS pixels that is provided by the OS when the VK visibility changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All references to variables (osk, lv, bounds, etc) should be of the form "|var|" rather than "var
". That enables various features such as variable highlighting, and makes it clearer that they are in fact vaariables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, |osk| and |lv| should be input parameters, and the caller should provide them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docs/virtualkeyboard/index.html
Outdated
</dt> | ||
<dd> | ||
<p> | ||
The attribute reports the intersection of the VK with the layout viewport in client coordinates. | ||
The attribute reports the intersection of the VK with the layout viewport in client coordinates. It is set when {{VirtualKeyboard/ongeometrychange}} event is fired. To create a {{VirtualKeyboard/boundingRect}} follow these steps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to mention when it is set here. It'd be sufficient to define an algorithm here (e.g. "set a virtual keyboard bounding rect"), and then call it before the event is fired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docs/virtualkeyboard/index.html
Outdated
@@ -128,7 +142,7 @@ <h2>The <dfn>VirtualKeyboard</dfn> Interface</h2> | |||
Call the system API to show the VK. | |||
</li> | |||
<li> | |||
When the VK is shown by the system, fire {{VirtualKeyboard/ongeometrychange()}} event. | |||
When the VK is shown by the system, <a href="https://html.spec.whatwg.org/#in-parallel">in parallel</a> the OS reports the bounding rectangle of the keyboard. Update the {{VirtualKeyboard/boundingRect}} which is the intersection of the keyboard rectangle reported by the OS and the layout viewport. Fire {{VirtualKeyboard/ongeometrychange()}} event to JS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move the "in parallel" bit up, into something like:
"""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Couldn't use [=viewport=] because for some reason css xref's are not working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcoscaceres - can you help on the [=viewport=] front?
docs/virtualkeyboard/index.html
Outdated
@@ -140,17 +154,21 @@ <h2>The <dfn>VirtualKeyboard</dfn> Interface</h2> | |||
The method must follow these steps: | |||
</p> | |||
<ol> | |||
<li>If the browsing context is not focused, abort these steps. | |||
<li> | |||
Let |window| be [=this=]'s <a href="https://html.spec.whatwg.org/#concept-relevant-global">relevant global object</a>. If |window| is not a <a href="https://html.spec.whatwg.org/multipage/window-object.html#window">Window object</a>, then abort these steps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above on abort and links
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docs/virtualkeyboard/index.html
Outdated
Let |window| be [=this=]'s <a href="https://html.spec.whatwg.org/#concept-relevant-global">relevant global object</a>. If |window| is not a <a href="https://html.spec.whatwg.org/multipage/window-object.html#window">Window object</a>, then abort these steps. | ||
</li> | ||
<li> | ||
If |window| does not have <a href="https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation">sticky user activation</a>, abort these steps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same nit on replacing links with references
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docs/virtualkeyboard/index.html
Outdated
</li> | ||
</li> | ||
<li> | ||
When the VK is hidden by the system, <a href="https://html.spec.whatwg.org/#in-parallel">in parallel</a> the OS reports the bounding rectangle of the keyboard (which has all 0 values). Create a {{DOMRect}} with 0 values and return it when {{VirtualKeyboard/boundingRect}} is queried. Fire {{VirtualKeyboard/ongeometrychange()}} event to JS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above on revamping to multiple steps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
docs/virtualkeyboard/index.html
Outdated
Let `bounds` be a {{DOMRect}} object. | ||
</li> | ||
<li> | ||
Set `bounds` to be the intersection of `lv` and `osk` in CSS pixels. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be better to do something like https://www.w3.org/TR/intersection-observer/#calculate-intersection-rect-algo here. You can't really reuse it as is, because |osk| is not a DOM element...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@yoavweiss Addressed all comments. PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I still have a few nits around turning links to refs, and one question on the IDL change, but overall this looks great. Thanks for bearing with me! :)
The attribute reports the intersection of the VK with the layout viewport in client coordinates. | ||
The attribute reports the intersection of the VK with the [=document=]'s <a href="https://drafts.csswg.org/css2/#viewport">viewport</a> in client coordinates. Call {{VirtualKeyboard/set the virtual keyboard bounding rect}}. | ||
<p> | ||
<p><dfn>set the virtual keyboard bounding rect</dfn></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"To set the virtual keyboard bounding rect, with |osk| (a DOMRect representing the on-screen keyboard rectangle), and |lv| (a DOMRect representing the document's viewport rectangle) as inputs, run the following steps:"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -189,17 +250,17 @@ <h2>The <dfn>VirtualKeyboard</dfn> Interface</h2> | |||
<h2>Extensions to the <dfn>ElementContentEditable</dfn> mixin</h2> | |||
<pre class="idl"> | |||
partial interface ElementContentEditable { | |||
[CEReactions, Reflect, ReflectOnly=("auto","manual")] attribute DOMString virtualKeyboardPolicy; | |||
[CEReactions] attribute DOMString virtualKeyboardPolicy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the IDL reflection rules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was getting ReSpec errors so the recommendation (per this comment) is to just mention it in the definition of the attribute and link it to the IDL. In my case I mentioned it in the virtualKeyboardPolicy
definition:
The virtualKeyboardPolicy is an enumerated attribute whose keywords are the string, auto, and manual. The IDL attribute must reflect the respective content attributes of the same name.
Thank you @yoavweiss for reviewing it! |
#314
Closes #????
The following tasks have been completed:
Implementation commitment: