web-platform-tests / interop

web-platform-tests Interop project
https://wpt.fyi/interop
302 stars 28 forks source link

ScreenOrientation: lock() method #738

Open shalanah opened 2 weeks ago

shalanah commented 2 weeks ago

Description

Video, interactive, and gaming mobile sites are often optimized for vertical or horizontal viewing. Orientation lock is important to give the user the best experience, avoid wasting development time, and to avoid bad app state by accidental rotations.

Missing from iOS/iPadOS. Good support on Android (2013-2015 implemented approximately 10 years ago) with the exception of Firefox for Android.

Missing from Desktop devices (understandably), would be best if also available on tablet touch devices.

Screenshot 2024-09-20 at 10 56 32 AM

MDN Screen Orientation Lock

Related Fullscreen API: https://github.com/web-platform-tests/interop/issues/732

Web Apps

With the advent of PWAs a future discussion point could be removing the fullscreen prerequisite.

Specification

https://w3c.github.io/screen-orientation/#dom-screenorientation-lock

Additional Signals

https://stackoverflow.com/questions/5298467/prevent-orientation-change-in-ios-safari

AshleyScirra commented 3 days ago

This is also useful for web games made in Construct so we support this.