fullscreen
fullscreen copied to clipboard
Exiting full screen should unlock screen orientation
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
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.
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.
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.
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.
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.)
It retains the orientation even if you rotate the device? How is it unlocked in that case?
Sorry, I was not clear. Imagine:
.lock("landscape")- screen orientation changes and locks to landscape.
- User physically rotates the device in their hand -90deg.
.unlock()- Screen stays in landscape, but it's "unlocked".
- User rotates device to portrait by rotating phone 90deg (back to starting position).
- 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.