Re: [whatwg/fullscreen] Introduce document.exitFullscreen({ fully: true })? (#70)

First of all, there is a way to get all fullscreen elements, and there is a way to check whether a specific element is in fullscreen state. That way is called CSS selector :)

All fullscreen elements match `:fullscreen` pseudo-class, thus you can always use `document.querySelectorAll(':fullscreen')` and `element.matches(':fullscreen')` for the aforementioned information correspondingly.

Having said that, `querySelectorAll` is essentially a full document / subtree scan, so it could be relatively slow, but if its usage is common enough, we can certainly optimize it from the UA side (based on top layer stack that UAs are aware of) without adding other API, I would argue. So I'm moderately against adding new API for fetching that information.

> In other situations, Browsers haven't considered the spec implications. Currently, Edge doesn't trigger fullscreenchange on the ELEMENT first (just on document directly), and Safari fails to enter a nested element into fullscreen mode at all. Again, browser bugs have been filed.

This is not going to be resolved by adding new APIs in the spec. When a browser doesn't have developer to maintain a feature actively, it's not very likely that they would follow changes to such spec closely.

> Even mainstream reference material does not take nested fullscreen properly into account. For instance:

Maybe issues should be filed against those materials to cover nested fullscreen.

> @upsuper @jernoble what are your thoughts on exposing the top layer elements or possibly only the fullscreen elements within, as well as document.exitFullscreen({ fully: true })?

As I mentioned, we already have API to query fullscreen elements, so I don't think we should add API for that.

And I think I'm kinda relatively strongly against exposing top layer elements, because top layer itself is not a web-exposed primitive, and it may be used for different stuff in the future, so if we expose it prematurely, we may footgun ourselves for that websites rely on it only returning fullscreen and modal dialog.

It doesn't seem to me that there is request to add API to query modal dialog, but if there is, I think we should as well just add a pseudo-class for that, so that authors can even style it accordingly, although I'm not sure whether that's actually useful at all.

As for `document.exitFullscreen({ fully: true })`, I'm not fully sure how I feel about it. I guess it's fine...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fullscreen/issues/70#issuecomment-469005965

Received on Sunday, 3 March 2019 09:46:50 UTC