-
Notifications
You must be signed in to change notification settings - Fork 43
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
Keyboard lock #231
Comments
@martinthomson is it a fair summary to say you're suggesting a way to request fullscreen and keyboard lock at the same time? cc https://wicg.github.io/keyboard-lock/ editors @garykac and @jamiewalch |
@martinthomson Thank you for brining this idea back.
|
From a user perspective, I don't think that there is much value in having an indeterminate set of key codes being routed to the site. Expectations are everything here, so I would suggest that while a site might choose not to listen for certain key codes, they would have the option of intercepting any key (aside from those special sequences that the host reserves, like The reason there is to avoid situations where expectations are built up about availability of certain sequences on one site, only to find that those expectations are invalid on another site. Sites can of course not bother to listen for certain codes, as is their prerogative. But they would receive them all. |
@martinthomson, do I have your permission to copy/paste part of the proposal as the basis for the pull request to the spec? (i.e., can I treat it also as "C0")? |
You have my permission, and blessing :) |
Thanks @martinthomson! Ok, here's a straw person based on Mozilla's proposal: It's drafty, so feedback very much appreciated! |
It's worth noting that even if a site ignores a certain key, the fact of intercepting it at the OS level changes its behaviour. The canonical example of this is a full-screen game that wants to:
We can't just intercept all keys and let the game ignore Alt+Tab, because then there's no way to "re-inject" it to support the second scenario. That's how we ended up with the current API design where the set of desired keys must be declared up-front. |
@martinthomson, @marcoscaceres could you please specify the key codes could be handled by each of browser and system enum of the proposal? |
@jamiewalch, I know that this is potentially a little more inconvenient, but a full-screen game could intercept Alt-Tab and relinquish full-screen access if they wanted to specifically enable that use case. What I'm most concerned about is the potential for selective key interception to be very confusing, so that the exit criteria are not always obvious. |
@xingri, that's a question that I don't think we can answer until we get to implementation. |
@martinthomson , @marcoscaceres I have evaluated the current keyboard lock interface and found that it should be working with the preventDefault call. Do both of you think it's ok to madate adding the steps of calling "preventDefault()" in case of the keys which need to be locked by the application? Which was not required by the https://wicg.github.io/keyboard-lock/ spec. // For browser(enum) from the FullscreenKeyboardLock { "none", "browser", "system" }; |
This might work for keys that would otherwise be handled by the browser (so the ones in your example would all work, I think), but it's not sufficient for system keys like Alt+Tab. These have to be intercepted (or not) at the OS level, and at least on some OSes (Windows and X11 Linux for sure) this needs to be synchronous, so you can't defer the decision to the web page. |
@jamiewalch Thank you so much for the prompt response. I forgot to mention that the above test code was for the browser (enum) use cases. |
https://bugs.webkit.org/show_bug.cgi?id=265923 Reviewed by Ryosuke Niwa. Add option compliant with the fulscreen proposal <whatwg/fullscreen#231>. * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WebCore/dom/Element.h: * Source/WebCore/dom/FullscreenOptions.h: * Source/WebCore/dom/FullscreenOptions.idl: Canonical link: https://commits.webkit.org/272933@main
What problem are you trying to solve?
Fullscreen applications might want to access keys that would ordinarily break out of the full screen state. For instance, games often use the ESC key to access menus, remote desktop applications often use keyboard shortcuts for app switching. Having these actions sent to the site, rather than the local system might be desirable.
What solutions exist today?
Google previously proposed https://github.com/WICG/keyboard-lock/
How would you solve it?
I made a proposal a long time ago here: https://docs.google.com/document/d/191YzTVJRg4mIkAYCHYbDYFugO4xiLw6xE_lDuUOfItQ/edit?usp=sharing
Some of those details might change in discussion. For instance, I consider points made by others (in comments on that document) about system key lockout to be convincing.
Anything else?
I'm making this contribution here to make clear that this proposal is covered by Mozilla's commitment to the WHATWG IPR policy. My intention is not to drive this work, but am willing to support someone who wants to pursue it.
The text was updated successfully, but these errors were encountered: