fullscreen
fullscreen copied to clipboard
Requesting orientation lock when going fullscreen
It might be nice to request a particular orientation when going fullscreen. The Screen Orientation API presupposes a "pre-lock condition", which in practice means "the document must be in fullscreen".
Given that precondition, we could most of the Screen Orientation API and just request the allowed orientations when requesting fullscreen:
element.requestFullscreen({
orientation: "landscape"
})
The advantages would be similar to those in #185:
- orientation lock management is simplified and just tied to fullscreen... user exists full screen, then unlock of the orientation just happens.
- prevent user annoyance, like arbitrary switching orientations (which the Screen Orientation API theoretically allows).
Is it related to my issue here #188 ? I think of a proper way to ask user to unlock fullscreen orientation in web
Requesting orientation with fullscreen seems like a nice ergonomic addition.
See relevant WebApps WG TPAC minutes. Some questions around that discussion may be pertinent (FYI @JakeArchibald and @kenchris):
- Whether orientation is a hint or requests fail and exit with errors. How sites might introspect supported values, locked values, and changes of each.
- Whether switching orientation(s) when already fullscreen would be supported (e.g. game starts "portrait-primary" for a menu, then changes to "landscape" for gameplay).
- Exploring the interactions of this proposed surface with
screen.orientation.lock()and Web Application Manifest's default orientation.
Thanks, let's see:
- I think it should be a hint. Once the fullscreen event fires if the state hasn't changed you'll know it didn't work out. (As discussed in an issue on the Screen Orientation spec whether it'll work out should maybe be available through feature detection: https://github.com/w3c/screen-orientation/issues/206.)
- You should be able to change orientation while fullscreen.