w3c / screen-orientation

The screen orientation lock specification
https://w3c.github.io/screen-orientation/
Other
27 stars 29 forks source link

Angle not consistently implemented #247

Closed marcoscaceres closed 1 year ago

marcoscaceres commented 1 year ago

Over on WebKit, we got a bug report that .angle (and .type) are not reported in an interoperable manner.

Using https://krpano.com/ios/bugs/ios164-screen-orientation/ and turning the device clockwise (there are helpful screenshots there too).

@karlcow did some testing and found:

Firefox Nightly 113 Android 13 screen.orientation.angle: 270 screen.orientation.type: landscape-primary

Chrome Canary 113 Android 13 screen.orientation.angle: 270 screen.orientation.type: landscape-secondary

Safari 16.4 iOS 16.4 screen.orientation.angle: 90 screen.orientation.type: landscape-primary

The spec and the tests agree with Webkit, but we may have a web interop issue at hand.

Should we change the spec to use counter clockwise values instead?

@makotokato, wdyt? It would be great if Firefox also reported "landscape-secondary" in this case.

makotokato commented 1 year ago

@makotokato, wdyt? It would be great if Firefox also reported "landscape-secondary" in this case.

I guess that this depends on Android version. (Android 11+ has a lot of changes for window manager of Android, so it seems to be incorrect on some device). I will fix it.

marcoscaceres commented 1 year ago

Ok, I guess I should flip the order for the .angles also to match Android in this case. That should also remove some weirdness from the spec, where it could return either 90 or 270.

marcoscaceres commented 1 year ago

Ok, sent a PR: https://github.com/w3c/screen-orientation/pull/248 ... other folks watching this, can you please also take a look to make sure everything is right?