Skip to content
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

Requesting orientation lock when going fullscreen #186

Open
marcoscaceres opened this issue Sep 18, 2020 · 3 comments
Open

Requesting orientation lock when going fullscreen #186

marcoscaceres opened this issue Sep 18, 2020 · 3 comments

Comments

@marcoscaceres
Copy link
Member

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).
@ramyareye
Copy link

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

@michaelwasserman
Copy link

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.

@annevk
Copy link
Member

annevk commented Oct 11, 2022

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: Add can-lock-orientation media feature to detect if locking is possible w3c/screen-orientation#206.)
  2. You should be able to change orientation while fullscreen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants