fullscreen icon indicating copy to clipboard operation
fullscreen copied to clipboard

Requesting orientation lock when going fullscreen

Open marcoscaceres opened this issue 5 years ago • 3 comments

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).

marcoscaceres avatar Sep 18 '20 07:09 marcoscaceres

Is it related to my issue here #188 ? I think of a proper way to ask user to unlock fullscreen orientation in web

ramyareye avatar Dec 19 '20 23:12 ramyareye

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.

michaelwasserman avatar Oct 10 '22 23:10 michaelwasserman

Thanks, let's see:

  1. 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.)
  2. You should be able to change orientation while fullscreen.

annevk avatar Oct 11 '22 07:10 annevk