-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Screen orientation change events as a special kind of user activation #8490
Comments
Perhaps a simple solution might be to add a @annevk, @domenic, @mustaqahmed, @michaelwasserman thoughts? |
How would that be different from |
The problem is calling So, if you have a PWA that is presented in full screen via web manifest (not via (I know you are not proposing this, but) making such events not trusted wouldn't be right, as they are user agent generated events. |
I'm hesitant about exposing this as an API until we've done more of a survey of use cases and other places where it might apply, but exposing it as an internal slot seems reasonable. Then we only have to worry about getting it right on specific places where callers need to check it. Some interesting related notes:
|
For the internal slot route, we could even be very specific for now, and just have something like "is a user-initiated orientation change event" or "is a special activation triggering event". |
Actually, However, there is some concern that changing the Screen Orientation spec might not be web compatible: w3c/screen-orientation#218 But |
Actually, yeah, thinking about what you said above @domenic... a very specific slot might make most sense because we only have one very specific use case: changing orientation should allow entering/exiting full screen. It would be bad if changing the orientation would allow, for instance, a popup window, initiate a payment request, initiate a web share, etc. |
A specific internal slot seems like the most appropriate option presented (but I'm still a relative novice here). |
element.click() is a horrible special case (like is dispatching click events from JS), because of legacy reasons. Effectively click handling doesn't care about isTrusted. It would be quite confusing if UA dispatched event had isTrusted sometimes true, sometimes false. isTrusted is supposed to mean whether UA dispatched it or it was dispatched from JS. That behavior is even documented in the DOM spec. |
Agree, let's put the The other problem is that even though it originates from an event, this needs to available at the window-wide (same as transient activation). That is, the UA should be to check: if "is a user-initiated orientation change event" OR "has transient activation" then ... enter fullscreen; otherwise reject. But "is a user-initiated orientation change event" has to expire with the same timing model as transient activation (and probably shouldn't count as sticky activation). |
Although I can see how orientation change allowing window.open() or PaymentRequest is weird, I will say that this will all be a lot easier if you reuse the existing user activation model. If you're willing to accept that consequence, then the spec modification is simply:
If you want to create a second thing, which is like user activation but not really, that's much more work. You would need to define something like:
|
Ok, I'm willing try the easy route and see if folks object. As already mentioned above, there are consequences, as some are a bit unexpected (specially around orientation change... particularly on desktop platforms, where screen orientation is usually changed through system settings instead of merely rotating one's hand). It's a bit weird, but so long as activation consuming APIs do the right thing, then it may be ok. @michaelwasserman how much "orientation specific" handling does Chromium have to handle the full screen specific case? In particular, how is timing handled in Chrome as @domenic describes in the second solution above handing Fullscreen + orientation change? @smaug---- or @EdgarChen, would you be amicable to considering orientation "change" events as an "activation triggered input event"? |
I think we should reuse user activation model as Domenic suggested, so considering some "change" events as user input sounds reasonable - assuming it is implementable. Do the OS level APIs let one to know how the orientation change was triggered? |
Granting transient user activation on orientation changes seems convenient, if excessive. I think Chrome currently grants fullscreen during execution of screen.orientation |
Thanks for calling out the "excessive" point. If the user changes the device orientation, it doesn't necessarily imply an interaction with the page, and that bring up a few challenges IMHO. For example, switching to landscape mode for convenience (like getting a wider view on the phone) is not uncommon. It seems pretty bad to me if a page can suddenly a open popup or start playing audio right after this event. Even worse would be a malicious ad |
That is a good point. Especially when using mobile devices I'd expect pages to get quite a few accidental change events. |
It's definitely a tradeoff between convenience and excessiveness, as I outlined in #8490 (comment). I come down on the convenience side, but if Gecko and Chromium would prefer defining a new concept to ensure we avoid any extra transient activations, that's probably fine... |
Could we tweak the existing model so that transient user activation is effectively a bitmap. In normal cases everything would be allowed (all the flags set), but in this case only one flag - fullscreen, was enabled. |
I can't see how that would really work. You still need to store separate timestamps for the different events, so it ends up seeming equivalent to the model I proposed. |
A common use case on video sites is:
.requestFullscreen()
and have such orientation changes be classified as "triggered by user activation".HTML currently specifies "activation triggering input events", but excludes orientation change events as counting as having "transient activation".
The Screen Orientation spec had some hacky text that would magically label these specific orientation events as having been initiated by the user. And the Fullscreen API was depending on that. However, it would be good to have a generic mechanism for labelling these Events properly and having them participate in the user activation model (i.e., they are classified as being part of "activation triggering input events").
The text was updated successfully, but these errors were encountered: