fullscreen icon indicating copy to clipboard operation
fullscreen copied to clipboard

Exiting full screen should unlock screen orientation

Open marcoscaceres opened this issue 3 years ago • 3 comments

When exiting full screen, FS API should unlock screen orientation.

Otherwise, things can get strange as seen here.

See also https://github.com/w3c/screen-orientation/issues/209

Cc @michaelwasserman

marcoscaceres avatar Oct 11 '22 05:10 marcoscaceres

And presumably it should restore the orientation the device had before going fullscreen? I guess that's a thing we need to store somewhere as part of requesting.

annevk avatar Oct 11 '22 08:10 annevk

I'm naive of mobile development patterns, but storing pre-fullscreen orientation (and locks) does seem significant.

Say a web application manifest's default orientation is portrait, then it uses screen.orientation.lock("landscape") for gameplay. During the game, a video cutscene/tutorial/ad is shown fullscreen (with or without changing the orientation). Exiting video element fullscreen to resume gameplay should probably not unlock orientation, but restore that pre-fullscreen orientation.

michaelwasserman avatar Oct 11 '22 18:10 michaelwasserman

Exiting video element fullscreen to resume gameplay should probably not unlock orientation, but restore that pre-fullscreen orientation.

Right, it would revert to the default orientation. However, in case where a developer manually request full screen on a video, they would then need to manage orientation themselves. However, if we have #186, FS API could "remember" and switch back to the previous orientation when full screen exits.

That would allow everything to work seamlessly with web manifest setting the default orientation, and the document changing the orientation.

marcoscaceres avatar Oct 12 '22 03:10 marcoscaceres

And presumably it should restore the orientation the device had before going fullscreen? I guess that's a thing we need to store somewhere as part of requesting.

Did some testing and it (Chrome at least) actually doesn't. It "unlocks" and always retains the current orientation. So, if you exit fullscreen in "landscape-*", you stay in "landscape-*. Same with "portrait-*".

What's interesting with "portrait-secondary" is that is unlocks, and then allows the user to change to "portrait-primary", but then the user can't manually go back to "portrait-secondary". I guess this is due to platform conventions on this particular phone. I don't imagine a tablet would exhibit such behavior.

marcoscaceres avatar Oct 31 '22 04:10 marcoscaceres

It retains the orientation even if you rotate the device? How is it unlocked in that case?

(It does seem good to just unlock and let any additional rotation depend on the device orientation.)

annevk avatar Oct 31 '22 11:10 annevk

It retains the orientation even if you rotate the device? How is it unlocked in that case?

Sorry, I was not clear. Imagine:

  1. .lock("landscape")
  2. screen orientation changes and locks to landscape.
  3. User physically rotates the device in their hand -90deg.
  4. .unlock()
  5. Screen stays in landscape, but it's "unlocked".
  6. User rotates device to portrait by rotating phone 90deg (back to starting position).
  7. Screen orientation switches to portrait, as expected.

(It does seem good to just unlock and let any additional rotation depend on the device orientation.)

Precisely. The OS takes over - or OS conventions are followed.

marcoscaceres avatar Nov 01 '22 03:11 marcoscaceres