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

Exiting full screen should unlock screen orientation #202

Closed
marcoscaceres opened this issue Oct 11, 2022 · 6 comments · Fixed by #206
Closed

Exiting full screen should unlock screen orientation #202

marcoscaceres opened this issue Oct 11, 2022 · 6 comments · Fixed by #206

Comments

@marcoscaceres
Copy link
Member

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

Otherwise, things can get strange as seen here.

See also w3c/screen-orientation#209

Cc @michaelwasserman

@annevk
Copy link
Member

annevk commented Oct 11, 2022

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.

@michaelwasserman
Copy link

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.

@marcoscaceres
Copy link
Member Author

marcoscaceres commented Oct 12, 2022

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
Copy link
Member Author

marcoscaceres commented Oct 31, 2022

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.

@annevk
Copy link
Member

annevk commented Oct 31, 2022

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

@marcoscaceres
Copy link
Member Author

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.

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

Successfully merging a pull request may close this issue.

3 participants