[w3c/screen-orientation] Promise for unlock()? (#104)

I understand that this might not be possible from the note -

> unlock() does not return a Promise because it is equivalent to locking to the default orientation which might or might not be known by the user agent. Hence, the user agent can not predict what the new orientation is going to be and even if it is going to change at all.

I am working on building an app that uses WebVR. Entering VR mode requires going fullscreen and then locking orientation to landscape. This works perfectly.

However exiting this mode when phone is in portrait orientation, on tested Android devices, results in the browser bar and menu disappearing and a large white space appearing under the app. Dragging down on the screen reveals the browser bar and covers the white space, you can not then drag back up.

![orientation unlock issue](https://user-images.githubusercontent.com/6083490/27416369-38a07dfa-5737-11e7-951f-db992d44388e.jpg)

I've overcome this issue using the following code
```
screen.orientation.unlock();
setTimeout( () => {
    fullscreen.exit();
}, 0 );
```
A cleaner solution would be something like -
```
screen.orientation.unlock().then( () => {
    fullscreen.exit();
});
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/screen-orientation/issues/104

Received on Thursday, 22 June 2017 03:44:49 UTC