New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 621921 link

Starred by 4 users

Issue metadata

Status: WontFix
Owner:
Last visit 22 days ago
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

Need a way to disable screen rotation with apps when in tablet mode

Reported by raniel...@gmail.com, Jun 21 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.41 Safari/537.36

Steps to reproduce the problem:
Steps to reproduce the problem:
1. On a convertible Chromebooks such as a ASUS flip either launch a app when in table mode, or start in laptop mode and switch to table mode.
2. Rotate tablet, and screen will rotate

What is the expected behavior?

What went wrong?
Screen rotated. Need a way to disable rotation. This is possible with Windows, Android and iOS.

WebStore page: 

Did this work before? N/A 

Chrome version: 50.0.2661.94   Channel: stable
OS Version: 7978.69.0
Flash Version: Shockwave Flash 22.0 r0
 
Can you use the APIs here? https://developer.chrome.com/apps/system_display
No we need ones that disable rotation, basically like Android has.

Comment 3 by raniel...@gmail.com, Sep 20 2016

This works with Android on CrOS as expected, but not with chrome apps on CrOS.
Cc: jonr...@chromium.org
CrOS supports the html Screen Orientation API.

When a tab is fullscreened rotation locks can be applied: https://www.w3.org/TR/screen-orientation/#dfn-lock-the-orientation
https://www.w3.org/TR/screen-orientation/#dfn-lock-the-orientation only works when you are in tablet mode already so it doesn't meet our needs. We don't have a way to tell that.

Can't we just have a way to lock the screen orientation like you have on Android on CrOS?
Cc: girard@chromium.org
The requests sent to that API should be saved, then applied once the tablet mode has been entered by a user. Is that not being seen?

This was done for the api, as we didn't see a use case for locking the screen to portrait while in laptop form. Could you provide some background on your use case?

Android on CrOS is actually using the same internal api that the html one is. The main difference being that each Android app is its own window, whereas for the web tabs need to be fullscreen before a lock is applied.

There are also currently some bugs with the Android api, which can erase locks set by users/tabs. So if you are testing a mix of Android and your website, that may be impacting you.
Requests to that API do not succeed when the device is in laptop mode (not tablet mode). This is the error in the console "Uncaught (in promise) DOMException: screen.orientation.lock() is not available on this device."

You can try this on the demo I created here: output.jsbin.com/sozolekevu

If you press the button while in laptop mode you will see the error and the orientation will not lock when switching to tablet mode. The same will work when pressing the button while in tablet mode.

This is what my call looks like to lock the orientation:
screen.orientation.lock('landscape');
Owner: girard@chromium.org
Status: Assigned (was: Unconfirmed)
Thanks for the sample.

Yeah this feels wrong, especially with it divergent from the Android support. I also see why it's occurring. 

girard@ ScreenOrientationProvider::LockOrientation right now exits early if screen orientation locking is not supported. However this is currently tied to touch view being active.

So it doesn't go an register the request amongst the set of requests in ScreenOrientationController. It should instead always pass along the request, and only apply while in touch view.
Any updates on this issue?
Cc: maxkirsch@chromium.org
Thanks jonross@, I agree and think this is something we should fix given the increasing # of convertibles in the field.  girard@, are you the right owner for this?
Status: WontFix (was: Assigned)
Latest CrOS (59) should have the rotation lock equivalent to Android.
Please reopen if you still have an issue with this implementation.
I just tried on CrOS 61 and I got the following error:
"screen.orientation.lock() is not available on this device"

The command I used was "screen.orientation.lock('landscape')'. Is there some other syntax that will work on CrOS?
I tried screen.orientation.lock('landscape') on Lenovo N20P chromebook on chrome os 68 but I get the error this api is not supported on the device.

I tried the app in kiosk mode , on non kiosk mode and also on the Chromium browser both in fullscreen and non fullscreen mode and I get the same error  i.e this api is not supported on the device..

So is the lock orientation javascript api supported by chromeos, if yes then which devices and os version is it supported
The api is supported on Chrome OS, but only while the device is in a tablet state.

The following should allow the tab to assume fullscreen, and for the orientation to be locked:
  document.documentElement.webkitRequestFullscreen();
  screen.orientation.lock('landscape');

Sign in to add a comment