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

Orientation lock is not reset during navigation between pages #66

Closed
alexshalamov opened this issue Sep 20, 2018 · 5 comments
Closed

Orientation lock is not reset during navigation between pages #66

alexshalamov opened this issue Sep 20, 2018 · 5 comments
Assignees

Comments

@alexshalamov
Copy link

Introduced by 8ae7f07

@kaixinjxq @rakuco please take a look.

kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
@kenchris
Copy link
Contributor

Running into some spec or browser bugs, bad behavior.

  • You might want an change event handler but not call it in some calls to lock(), but the change event is fired after the lock promise resolves
  • lock to 180 succeeds even though it doesn't rotate on Android and you then don't get change event

@kaixinjxq want to create test cases for wpt and report to Chrome/spec?

@rakuco
Copy link
Member

rakuco commented Sep 21, 2018

Running into some spec or browser bugs, bad behavior.

An easily reproducible bug, for example: with the phone in portrait mode, rotate to 180 then try rotating to 90. The first rotation does nothing but enter fullscreen mode, the second rotation works for a second or 2 then resets everything.

kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
kenchris added a commit to kenchris/generic-sensor-demos that referenced this issue Sep 21, 2018
@rakuco rakuco closed this as completed in 8fc1a5a Sep 21, 2018
@kenchris
Copy link
Contributor

Different variations with 180 fails:

270 - 180 - 90 fail
90 - 180 - 270 fail
180 - 90 fail
90 - 180 - 0 fail

It fails with AbortError. As 180 (portrait-secondary) completes with success without changing orientation, it makes sense if you read the spec text:

https://w3c.github.io/screen-orientation/#dfn-apply-an-orientation-lock

If one of the browsing contexts's document's pending promise is not null:
Let doc be the document which has a not null pending promise.
Reject doc's pending promise with DOMException whose name is AbortError.
Set doc's pending promise to null .

There is probably a pending promise that was never dealt with as it just "completed"

@rakuco
Copy link
Member

rakuco commented Sep 21, 2018

I've filed #72 to keep track of all these orientation locking bugs.

@kenchris
Copy link
Contributor

Surely looks like a Chrome bug, given that lock('portrait-secondary') succeeds but doesn't rotate and therefore doesn't send 'change' event.

Different variations with 180 (portrait secondary) fails, eg.

270 - 180 - 90 fail
90 - 180 - 270 fail
180 - 90 fail
90 - 180 - 0 fail

It fails with AbortError. As 180 (portrait-secondary) completes with success without changing orientation, it makes sense if you read the spec text:

https://w3c.github.io/screen-orientation/#dfn-apply-an-orientation-lock

If one of the browsing contexts's document's pending promise is not null:
Let doc be the document which has a not null pending promise.
Reject doc's pending promise with DOMException whose name is AbortError.
Set doc's pending promise to null .

There is probably a pending promise that was never dealt with as it just "completed"

Additional annoyance with the orientation lock API, is that the promise resolves before the event is sent. This makes it hard to default handlers that you don't want to call in certain cases, because if you remove the handler then there is no good place to add it back in, because if you do after the promise gets resolves, it might get called as the event is still pending :-( Would be good to file on the spec, plus might also then make sense for the unlock to return a promise.

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

No branches or pull requests

3 participants