whatwg / fullscreen

Fullscreen API Standard
https://fullscreen.spec.whatwg.org/
Other
105 stars 43 forks source link

Requesting orientation lock when going fullscreen #186

Open marcoscaceres opened 4 years ago

marcoscaceres commented 4 years ago

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:

ramyareye commented 3 years ago

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

michaelwasserman commented 2 years ago

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

annevk commented 2 years ago

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.