Skip to content
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

Is navigator the right place? #387

Closed
alice opened this issue Aug 18, 2020 · 2 comments
Closed

Is navigator the right place? #387

alice opened this issue Aug 18, 2020 · 2 comments
Assignees

Comments

@alice
Copy link

alice commented Aug 18, 2020

Coming here from the TAG review thread.

We had some doubts as to whether navigator was the right place for the virtualKeyboard object to live, as opposed to window. What was the reasoning behind this choice?

@BoCupp-Microsoft
Copy link
Contributor

In Chromium browsers, navigator.keyboard is an instance of the Keyboard object. It seemed complementary to create a navigator.virtualKeyboard rather than place it on window.

If you ask, why is there a keyboard property on navigator, then I'm less certain of the reason, but I suspect its because Navigator is home to other "device or system-like" APIs. Examples include: Gamepad API, Media Input Devices, and WebUSB.

Maybe you knew all that already and your point is that a VirtualKeyboard is not a device attached to the system and in that sense is not like the other interfaces exposed on Navigator. In that case I'd point out that Navigator by definition is the place to represent the state of the user agent, and VirtualKeyboard describes whether the user agent is in a state that could shrink the visual viewport when the virtual keyboard comes up. Similar examples of system-wide, software state exposed by Navigator include clipboard, languages, and many others.

Trying to come up with a general rule for when to put an instance of an object on Navigator: I think it is when the interface you're exposing controls access to a system-wide resource and any changes in the state of that resource affects all realms.

Let me know if you disagree with this thinking. I don't see any rules that declare when you should add to the Navigator interface. I can open a design principles bug if you like to create guidance that explains why so many "system-level" APIs have been gathered there.

@snianu
Copy link
Member

snianu commented Nov 19, 2020

TAG reviewed the explainers and the discussions we had in TPAC and supported the proposal.

@snianu snianu closed this as completed Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants