-
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
inputPanelPolicy as a way to control software keyboard #225
Comments
Resolution call 2020-01-10: @gked will create a PR to HTML spec with the new attribute proposal. |
Why the name Also most web APIs say |
@othermaciej thank you for your feedback. Well, inputPanel is more than just a keyboard, it could also be an inking panel: Another scenario I could think of is some Dictation UI powered by the OS.
Fair point I will update the post. |
At least on iOS, handwriting keyboards are still considered keyboards. And on any platform/browser that allowed inline handwriting speech entry, I would not expect this API to suppress it. Beyond the mobile touch UI model, I'm not sure this API actually generalizes. (I'm not clear enough on the intended use case for suppressing dictation UI; I haven't personally seen elaborate UI like that.) And in any case, I think naming after the most obvious/common use case helps in API just as it does in issue titles. After all, this issue is not titled with "a way to control input panel" b/c it would't be obvious what that means. One other terminology note: "onscreen keyboard" seems more precise than "software keyboard", even if it's just a description and not in the API name. There can be such a thing as a keyboard totally driven by software which is not on the same screen as the content and which therefore should not be suppressed. |
Agreed and I am not attached to the name perse. I would be opened to other suggestions. |
@gked Thanks for writing this up! Could you format that as an Explainer on GitHub (perhaps in this group's space)? (As it stands, it's more of an Explainer-level design document than a spec draft, and in any case we don't usually use Google Docs either for explainers or for specs). |
@BoCupp-Microsoft and @snianu to give credit to for this |
@othermaciej FYI - here is the public explainer |
Given there is no mechanism to manually bring up a software keyboard on iOS, I don't think this API makes much sense to support on iOS. |
@rniwa What do you mean by "manually bring up a software keyboard" exactly? Like a button in the shell that pulls up the VK or a system API that can be called to show the VK? I think there is a similar API on Android(and maybe ChromeOS?) that lets you raise the VK through a system API call, but yes, pulling up the virtual keyboard through a button in the shell is I guess only supported on Windows for now. The API proposal is not just for scenarios where user can pull up the VK through a button in the shell. It is basically a mechanism to control VK behavior through system API calls which currently can't be done deterministically in JS. |
So the issue is that when It would need to be solely up to the web developer to use the |
Well, if there is no system API to raise/dismiss VK, then I'm guessing there wouldn't be an API to suppress VK either? It would always behave like |
Ah, so there does exist system API on iOS to show or dismiss the keyboard at arbitrary times. Ryosuke and I were more worried about the user not being able to interact with UI in order to bring up the keyboard in the case where the website doesn’t call You’re right that this would be a site bug, but at the same time, we’re concerned that web authors may only test on devices that support a manual “show keyboard” button (e.g. Microsoft Surface), and not realize that adding only this attribute with no accompanying logic to show the keyboard will cause issues for iOS users. |
That is a good point. I think we somehow missed to address this part in the explainer, but we did discuss about it when we were reviewing this API with our OS team. Additionally, calls to show or hide the keyboard should only be honored (or lead to a permission prompt) when they are received from a realm with an active document which has received some user interaction. |
@smaug---- Could you please give us some feedback or tag the appropriate person from Firefox who could review this proposal? |
I don't think malicious case is interesting because it can only affect the website itself. A more common scenario is the lack of knowledge / testing that results in a website being non-functional on iOS devices. Given the number of websites that lock themselves to only support Chrome in wild, I don't think we want to take that kind of risk.
I don't think permission makes much sense for this feature since it has such small end-user impact when it works, and the end user are unlikely to fully understand the implication of the issue otherwise. |
@mustaqahmed from Chrome side. |
I think there is some confusion here. Show/Hide APIs that is on VirtualKeyboard interface, is just a way to explicitly trigger VK. Calling show/hide when Re permissions: VirtualKeyboard is a feature provided by the OS (Text Input service on Windows to be more precise) and not the Browser. If the VK doesn't work on a platform, then |
There is no confusion there.
Nor here.
I understand that's a scenario important on your platform (e.g. Surface), but that's wholly adequate on iOS and iPadOS. And what you're proposing isn't not gonna work on our platform because there is simply not a mechanism for user to control when a virtual keyboard will be shown, and override what a website is doing.
This is problematic for us either way since we make both the browser and OS. In general, we don't want user experience to degrade because there was an oversight by an author.
Again, we don't think permission is the right model for this. Users aren't going to understand what it means, and in cases where it works, it fatigues users of permission dialogs / sheets. |
What if on platforms without a VK button, the browser provides a workaround for users and informs them when The triggering of the "info bar" could be tied to Does it look like a reasonable solution? |
We are not worried about a website doing this maliciously. Then the website just sucks, and no one uses it. We are worried about a website doing this accidentally, because they only test on other platforms that always have a way to manually bring up the keyboard, and not on iOS/iPadOS, which do not have such a button. inputMode=none doesn’t seem the same issue because it says to never show the keyboard, not to put it under manual control. Permissions don’t address this because the permission is not likely to be comprehensible and it will just contribute to alert fatigue. Adding a browser-specific button to show the keyboard seems like it is fighting the OS design of not having such a button. Users would be puzzled why this is a thing only in the browser. It’s basically changing the design of iOS to match other platforms that have manual control of the keyboard. This may well be a solvable problem but none of solutions proposed here seem workable so far. |
Is your specific concern that the developer will rely on the shell to let the user show/hide the keyboard and leave the input controls in manual mode because, e.g. the author prefers to not have the keyboard show up automatically? I don't think this will happen as it would result in a very poor experience on Windows as well. When a user taps on an edit control on a touch device (without a hardware keyboard attached) the user expects the VK to automatically appear - just like on iOS. The touch keyboard button doesn't show up by default. The user must customize the start bar to show it. It isn't a prominent feature of the OS like, e.g. the back button is on Android phones. Author's won't build sites assuming its presence - at least not based on the Windows experience. |
I hiding the keyboard without showing it produces a near-equally-bad experience everywhere, then it likely doesn't have the specific hazard of accidental misuse. It would be nice if it was more clear that it's a feature for experts who are doing things manually. I could imagine having it controlled by script, since the attribute almost certainly should not be respected when JavaScript is disabled. Additional note: why does the Virtual Keyboard API need to provide metrics for the size of the keyboard? Visual Viewport API should already be a way to find out how much space is taken up, whether by the keyboard or other things, including events to monitor it. A number of sites already use it in this capacity, to the point that we implemented it last year so that iPad could better support desktop sites. Seems unnecessary to have two ways to do it.) (BTW, I prefer "onscreen keyboard" to "virtual keyboard" or "software keyboard", it's more clear about what it actually is. You could imagine a keyboard being "virtual" or software-driven in some way without actually ever appearing on the same screen as content, which is the relevant consideration for these types of features.) |
@othermaciej Re: Geometry of the VK - This is mainly for devices with dual screen where the VisualViewport change only gives the rectangle that is occluded by the VK, but really the content that is occluded by the VK only covers one screen and not the other. This explainer has screenshots describing the dual screen in greater detail. |
Shouldn't VisualViewport API be then improved to cover also that use case, report metrics also in dual screen. |
@smaug---- @othermaciej We didn't want to describe the Visual Viewport with a path instead of a rectangle, i.e. let's not create L-shaped viewports. The Virtual Keyboard API includes a property "overlaysContent" which tells the browser not to resize the Visual Viewport in response to the appearance of a docked VK. Setting this property true opts in to separate keyboard geometry events and stops reducing the size of the Visual Viewport so as not to waste space in dual screen scenarios. It is specifically because we're not changing the size of the Visual Viewport that we didn't extend the existing API. |
@BoCupp-Microsoft that seems even more confusing. One of the main purposes of Visual Viewport is for content to avoid the keyboard. Having a different API that essentially "turns off" this functionality of Visual Viewport and provides similar info does not seem like a coherent API story. |
@othermaciej as I understand it the Visual Viewport API describes the viewport, not the on screen keyboard. Certainly the keyboard can influence the size of the viewport - so can resizing the browser - but in my mind that doesn't make a viewport API an ideal API surface for controlling or describing the the on screen keyboard. In these two explainers: Virtual Keyboard API, Virtual Keyboard Policy, we describe the capabilities of the virtual keyboard API:
As an author I would be surprised to find all these keyboard related capabilities on a viewport API. The only connection to the viewport is the ability to request that the keyboard not resize the viewport when shown. |
It totally makes sense for some of those capabilities to be separate. But the viewport-related ones seem misplaced or duplicative. Visual Viewport API is not required to react to browser resizes. Legacy APIs cover that case ok. The only new use cases it enables are adapting to onscreen keyboards and to adapt to auto-hiding browser UI (since that often doesn't trigger resize events). If we conclude that Visual Viewport API is not good enough for web content to adapt to onscreen keyboards, and can't be enhanced to provide content authors what they need, then perhaps we should deprecate it, or limit its scope to autohiding UI. But I think that would be a bad outcome. I think Visual Viewport API could be enhanced to report individual overlay rects. That way, authors who want to adapt to available screen space won't have to juggle two different APIs. And we won't need to invent still other new APIs for other forms of onscreen overlays, like PIP, or the iPadOS Universal Callout Bar which appears even with a hardware keyboard attached. In brief, we should inventing a whole new API each time there is major new work to communicate available screen space to web content. That is an anti-pattern. Instead, let's try to enhance existing APIs. On the other hand, it seems totally reasonable to me for API to explicitly show or hide the keyboard and the like to be in a different place. |
It has been brought up by few online editors that they need a way to control a software keyboard by not making it to show up in certain cases. Detailed discussion can be found here.
EditContext API proposal exposes such an attribute and we think, it would be beneficial to expose it on all editable elements.
The idea is to introduce an inputPanelPolicy attribute that when set to manual will prevent software keyboard from showing up even when there is user focus tap. This is a html spec related issue, but we wanted to get some feedback from the community on the proposed solution.
some early thinking:
inputPanelPolicy when set to manual before user taps on the editable field, will prevent the software keyboard from showing up.
If a web developer wants to drive software keyboard regardless of its current state, they could achieve that with also using additional inputPanelPolicy attribute values. Something like
hidden
andshow
.So there could be a total of four attribute values: [auto, manual, show, hidden] to controls behavior of and also to drive the keyboard to appear or get dismissed.
[EDIT] I've removed reference to inputMode as it is really about controlling the layout of the virtual keyboard.
The text was updated successfully, but these errors were encountered: