-
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
VirtualKeyboardAPI spec draft #309
Conversation
docs/virtualkeyboard/index.html
Outdated
<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. |
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.
That seems kinda circular. It'd be good to define what the call actually does.
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.
For example, I'm guessing it's impacting boundingRect
in some way.
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.
Similarly, it probably fires the geometrychange
event at some point.
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 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)
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.
updated
docs/virtualkeyboard/index.html
Outdated
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. |
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.
If I'm reading the sticky activation algorithm correctly, it applies to a Window object, not a Document.
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 would be good to clarify which Document (or Window) we're talking about
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.
updated
docs/virtualkeyboard/index.html
Outdated
<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. |
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
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.
updated
docs/virtualkeyboard/index.html
Outdated
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. |
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.
Examples below are showing them returning a Promise. Would be good to clarify which variant is implemented.
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.
updated
docs/virtualkeyboard/index.html
Outdated
</dt> | ||
<dd> | ||
<p> | ||
The attribute enables the author to opt-out of resizing the 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.
Would be good to define a setter that impacts the processing and does the actual opt-out.
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.
updated
</dt> | ||
<dd> | ||
<p> | ||
The attribute reports the intersection of the VK with the layout viewport in client coordinates. |
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 should define a getter that defines what's returned 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.
updated
</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. |
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.
Similarly to the above, you probably want to define the processing for this attribute: what happens when it's set, changed, removed, etc.
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.
updated
<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> |
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 probably want to define the semantics of each of these variables and what its value is set to.
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.
updated
@yoavweiss We addressed your feedback. Could you please let us know if they resolve your questions? One thing, I am trying to resolve currently is making adding the ability to make a PR readable with .pr-preview.json file. |
docs/virtualkeyboard/index.html
Outdated
<body> | ||
<section id='abstract'> | ||
<p> | ||
The {{VirtualKeyboard}} API provides web developers a more granular control of on-screen keyboard (virtual keyboard or VK). The API also provides information about VK geometry, such as rect occlusion and gives ability to opt-out from resizing of the visual viewport in the browser. |
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.
nit: grammar issue with "a more granular control"
Suggested new abstract: The {{VirtualKeyboard}} API provides authors with greater control over the visibility of the virtual keyboard (VK), and greater ability to adapt the layout of web pages when 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.
updated
docs/virtualkeyboard/index.html
Outdated
<h2>Introduction</h2> | ||
<P>This section is non-normative.</P> | ||
<p> | ||
The Virtual Keyboard (VK) is the on-screen keyboard used for input in scenarios where a hardware keyboard may not be available. Unlike hardware keyboard, VK can adapt its shape to optimize for the expected type of input. |
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.
Suggest cutting this sentence as it doesn't seem relevant to the API: Unlike hardware keyboard, VK can adapt its shape to optimize for the expected type of input.
I think it was useful in the explainer since we were pointing out a gap that inputMode was overloaded to control both shape and visibility and couldn't do both at once, but in the spec I don't see that it's necessary.
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.
agreed - updated.
docs/virtualkeyboard/index.html
Outdated
<P>This section is non-normative.</P> | ||
<p> | ||
The Virtual Keyboard (VK) is the on-screen keyboard used for input in scenarios where a hardware keyboard may not be available. Unlike hardware keyboard, VK can adapt its shape to optimize for the expected type of input. | ||
In addition, user agents respond to the presence of the VK, without any exposure of this information to web developers. This document proposes a new web API surface for VK that developers can use to enable better customization of their webpage's content and experiences. |
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 it would be useful in this paragraph to expand on how user agents currently respond to the presence of the VK and what alternatives this API offers. As is I don't think it adds anything compared to the abstract.
Maybe: User agents respond to the presence of the VK by:
- Repositioning the user agent above the VK
- Reducing the size of the layout viewport so the VK doesn't occlude it
- Reducing the size of the visual viewport and padding the layout viewport to ensure it can be shifted above the VK
This API provides a fourth option that allows the user agent to leave its layout and visual viewports unchanged and instead provide information about the intersection of the VK and layout viewport so that the author can adapt the layout of their web pages using JavaScript or CSS environment variables.
It would be good to have graphics illustrating the difference between these behaviors.
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.
updated
|
||
[Exposed=Window] | ||
interface VirtualKeyboard : EventTarget { | ||
undefined show(); |
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 this should be void
instead of undefined
.
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.
we were getting respec errors when we used void
. Web IDL recommends using undefined
instead of void https://heycam.github.io/webidl/#idl-undefined
docs/virtualkeyboard/index.html
Outdated
<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> | ||
<li> | ||
If the focused element's <a href="https://html.spec.whatwg.org/multipage/interaction.html#attr-contenteditable">contenteditable</a> value is false, 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 don't think this is meant to be limited to contenteditable. It should say something like: If the focused (is focused the right word) element is not editable...
We want to include textareas, text-like inputs, and any inputs into which the user can type (in the near future EditContext associated elements too).
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.
updated.
docs/virtualkeyboard/index.html
Outdated
</dd> | ||
<p class="note"> | ||
Platform heuristics may impose additional restrictions on VK {{VirtualKeyboard/show()}} and {{VirtualKeyboard/hide()}}. e.g., On Windows the pointer type has to be | ||
touch or pen. |
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.
nit: other paragraphs don't have hard line breaks dividing their content... remove this one?
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.
updated
docs/virtualkeyboard/index.html
Outdated
touch or pen. | ||
</p> | ||
<p class="note"> | ||
A few people have expressed concerns around {{VirtualKeyboard/show()}} and {{VirtualKeyboard/hide()}} methods not being promise-based. However, we could not find any real use cases around needing promises in this type of operation. |
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 link to an issue?
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.
updated
docs/virtualkeyboard/index.html
Outdated
</dt> | ||
<dd> | ||
<p> | ||
To set the attribute to opt-out of resizing the 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.
Can you say something slightly stronger here: a user agent MUST NOT resize its layout viewport or visual viewport when overlaysContent is true?
Also, I think only top-level browsing contexts are allowed to set this, right? This would probably be the place to mention requirements like that. I think there are other requirements too (secure origin maybe)?
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.
Updated the spec to reflect on your first comment.
Is defining SecureContext in web idl enough so we don't have to mention it here?
</section> | ||
</section> | ||
<section> | ||
<h2>Privacy and Security Considerations</h2> |
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.
Several pieces of information in this section seem like a set of claims that this API doesn't come with significant risk to privacy or security. I don't think we need to cover that. I expected this section to enumerate important implementation details that UAs may or must follow to ensure a secure and privacy preserving implementation. Additionally, I think it would be appropriate to enumerate the responsibilities of authors, if any, to ensure they don't create privacy or security issues when using the API.
Maybe IndexedDB is a good example.
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.
Updated. Is this what you had in mind?
</section> | ||
</section> | ||
<section> | ||
<h2>Examples</h2> |
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 there were good images in the explainer to go with these examples. Can you include them to help illustrate the impact of the code?
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
.pr-preview.json
Outdated
@@ -1,4 +1,4 @@ | |||
{ | |||
"src_file": "index.html", | |||
"src_file": "\\docs\\virtualkeyboard\\index.html", |
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.
are those Windows-slashes?
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.
Thanks! fixed. This is probably why the preview functionality didn't work :)
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 looks good enough to me to merge and subsequent issues we can deal with in smaller easier to review PRs.
This is the first draft of the spec to iterate on.
No tests, so far, just the wording around the behavior of the API.
There are a few respec errors that we'll be looking at as well.
The following tasks have been completed:
Implementation commitment: