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

PWA: Automatic screen orientation does not work in Chrome on Android #3413

Closed
Beet4 opened this issue May 17, 2023 · 31 comments
Closed

PWA: Automatic screen orientation does not work in Chrome on Android #3413

Beet4 opened this issue May 17, 2023 · 31 comments
Assignees
Labels
released Available in the stable release ux Impacts User Experience

Comments

@Beet4
Copy link

Beet4 commented May 17, 2023

1. What is not working as documented?

Running Android 13 on OnePlus 8 Pro and latest PhotoPrism as PWA in Chrome 113.0.5672.76.

The PWA does not rotate the screen when screen rotation is unlocked in the phone. Starting a video in fullscreen forces the PWA from portrait to landscape. After closing the video the PWA rotates as expected. After completely closing the PWA and re-opening it again screen rotation no longer works again.

It works fine if I open PhotoPrism normally in Chrome for Android. Other PWA in Chrome rotates as expected.

2. How can we reproduce it?

Steps to reproduce the behavior:

  1. Install PhotoPrism as PWA in Chrome for Android.
  2. Enable automatic screen rotation in the OS.
  3. Open PhotoPrism PWA
  4. Try and lay the phone in landscape, PhotoPrism does not rotate.

When reporting an import, indexing, or performance issue, please include the number and type of pictures in your library, as well as any configuration options you have changed, such as for thumbnail quality.

3. What behavior do you expect?

PhotoPrism PWA to rotate when screen orientation is set to automatic in the OS.

@Beet4 Beet4 added the bug Something isn't working label May 17, 2023
@lastzero lastzero changed the title Android Chrome PWA Automatic screen orientation does not work PWA: Automatic screen orientation does not work in Chrome on Android May 18, 2023
@lastzero lastzero added the needs-analysis Requires further investigation label May 18, 2023
@graciousgrey
Copy link
Member

We have tested this on Android 11 and 12 - there it works properly.

It may be related to the Android version or the phone itself. Has anyone else experienced this?

@lastzero
Copy link
Member

Maybe other Android users could help us test this, e.g. on their own device or using an emulator on a desktop computer? 🤖

@lastzero lastzero added help wanted Well suited for external contributors! easy Easy issue for beginners ux Impacts User Experience labels May 19, 2023
@Beet4
Copy link
Author

Beet4 commented May 25, 2023

My wife just purchased the Galaxy S23+ with Android 13, it is showing the same behavior as my original post when installed as PWA in Chrome. As said, it works fine when using it directly in chrome without installing the app.

So two different manufacturers but both on Android 13 - so perhaps an issue in Android 13?

@rnik12
Copy link

rnik12 commented May 29, 2023

Screen Orientation is working fine in my Samsung M31 - Android 12

@dbs-sticky
Copy link

I have no idea what PhotoPrism is, but I had a client just report a bug on one of my products (a PWA), and I ended up on this thread. Here's what I found.

  1. My PWA works fine on Android 12, and iOS
  2. My PWA DOES NOT work on Android 13 on my Pixel 6 Pro
  3. My PWA DOES WORK on a friends Pixel 6 (not Pro, same Android version and OS as mine!)
  4. Other PWAs (including the PhotoPrism demo) DON'T work on my Pixel 6 Pro.

In summary, I can't get any PWAs to rotate on my Pixel 6 Pro (yes, Auto-rotate is on). I don't think this is specific to PhotoPrism, but, it also doesn't seem to be a Android 13 issue either. As far as I can tell at the moment it's specific to Android 13 and "some" devices. I'm not sure this is very helpful though.

Note. On my Pixel 6 Pro. web site rotates in chrome, after installing the PWA, the app DOES rotate. If I then kill the app, and open it again, this is when if fails to rotate.

@dror3go
Copy link

dror3go commented May 31, 2023

Forget about Android versions - what about Chrome versions?

@dbs-sticky
Copy link

dbs-sticky commented May 31, 2023 via email

@spuxx1701
Copy link

spuxx1701 commented Jun 14, 2023

I can confirm this and it's not due to wrong manifests. By default (without an 'orientation' entry in manifest), the PWA should accept the device's orientation while respecting orientation lock. Setting any orientation value in the manifest will ignore rotation lock, which appears to be intentional.

Firefox PWA appears to behave correctly.

@sltvtr
Copy link

sltvtr commented Jun 22, 2023

I can confirm also - Photoprism installed as PWA from Chrome does not allow to rotate screen no mater what.
Chrome version: 114.0.5735.130 (I guess the latest)
Android: 13
Phone: Samsung Galaxy S20FE
It works when used as "normal" page inside browser.

And as a workaround I've tried installing PWA from Firefox - and that works! Thanks @spuxx1701 for the tip!

@spuxx1701
Copy link

Pretty sure it's an upstream issue with Chrome not behaving according to the spec

@lastzero lastzero added waiting Impediment / blocked / waiting and removed bug Something isn't working easy Easy issue for beginners labels Jun 27, 2023
@lastzero
Copy link
Member

I've removed the "bug" label for now as it's unclear if/how we can fix this on our side. Let us know when you have other information.

@mariokandut
Copy link

mariokandut commented Jul 26, 2023

Came here through a Google search. Issue (pwa not rotating after chrome install) seems resolved after deleting the app and reinstalling it in chrome (Google pixel 6pro, Android latest)

I restarted the phone, and now it doesn't work anymore. I have closed and minimized the app before and it worked fine.

@lastzero
Copy link
Member

@mariokandut That makes sense, since the manifest file cannot be excluded from caching:

So if there is a problem or we have improved it, there may be no other way than to delete and reinstall the PWA.

@Beet4
Copy link
Author

Beet4 commented Jul 27, 2023

I updated Chrome to latest and reinstalled the PWA but it does not work for me still.

@ssratma
Copy link

ssratma commented Sep 6, 2023

I ran into same problem and found that the solution is to remove the id option from the manifest file. Mine currently has name, short_name, scope, icons, start_url, display, and orientation. I have full orientation control with chrome for android with the id option removed. With it, the orientation option is ignored and is locked in portrait.

@lastzero
Copy link
Member

lastzero commented Sep 6, 2023

@ssratma Which "id" option? These are the manifest values that our backend currently returns and there's no "id" option here from all I can see:

Name string `json:"name"`
ShortName string `json:"short_name,omitempty"`
Description string `json:"description,omitempty"`
Categories list.List `json:"categories"`
Display string `json:"display"`
ThemeColor string `json:"theme_color"`
BackgroundColor string `json:"background_color"`
Scope string `json:"scope"`
StartUrl string `json:"start_url,omitempty"`
Serviceworker Serviceworker `json:"serviceworker,omitempty"`
Permissions list.List `json:"permissions"`
Icons Icons `json:"icons"`

@Maxim270693
Copy link

Hello, please tell me how you solved the problem with rotating the screen in PVA on version 13 of Android?
Rotation works on versions 12 and below, but does not work on version 13

@Beet4
Copy link
Author

Beet4 commented Oct 9, 2023

As far as I know it hasn't been solved yet as it seems to be an upstream issue with Chrome.

Edit: Removed and re-installed the PWA to test just now, and it's not working with latest Chrome still.

@Maxim270693
Copy link

@Beet4 Thank you

@ssratma
Copy link

ssratma commented Oct 10, 2023

Lastzero, sorry for delay in answer. I do not use this PWA specifically, and was google searching issues to resolve my own PWA. After looking at your discussion, it may be necessary to add an "orientation" value of "any" (you could use a set of values to lock orientation to a specific [one). Hopefully this helps resolve your issue.

lastzero added a commit that referenced this issue Oct 10, 2023
Signed-off-by: Michael Mayer <michael@photoprism.app>
@lastzero
Copy link
Member

@ssratma Thanks! I've changed this and started a new preview build for testing the changes. Any help with this is much appreciated, see https://docs.photoprism.app/getting-started/updates/#development-preview.

@lastzero lastzero added please-test Ready for acceptance test and removed waiting Impediment / blocked / waiting labels Oct 10, 2023
@lastzero lastzero self-assigned this Oct 10, 2023
@lastzero lastzero removed the needs-analysis Requires further investigation label Oct 10, 2023
@Massi-X
Copy link

Massi-X commented Oct 10, 2023

Can confirm this, orientation is now a mandatory field if you want rotation (even if not clearly stated anywhere). Tested on my PWA.

@Beet4
Copy link
Author

Beet4 commented Oct 11, 2023

@lastzero Tested :preview PhotoPrism® CE Build 231010-2f9792e54 and confirmed working. Pulled latest preview and reinstalled PWA in Chrome for Android (latest stable, 117.0.5938.153) and automatic orientation now works as expected. Tested on Samsung Galaxy S23+, Android 13 with latest patches.

@graciousgrey graciousgrey added released Available in the stable release and removed help wanted Well suited for external contributors! please-test Ready for acceptance test labels Oct 11, 2023
@Massi-X
Copy link

Massi-X commented Oct 20, 2023

@lastzero I discovered that while any works, it's still not perfect. If the device has locked rotation enabled, any will not respect that and always rotate. Did not find a solution yet.
Reading through w3 you can see that default should be the right value, needs more investigation.

@lastzero
Copy link
Member

@Massi-X Thanks for sharing your research! Would it still be ok to use "any" in our upcoming release? We can change it to "default" later if that provides a better experience and is supported by all devices.

@Massi-X
Copy link

Massi-X commented Oct 20, 2023

I don't really know if default it's a valid value because MDN doesn't quote it, needs to be tested.

@JhonnyJason
Copy link

Hello guys!
This is unrelated to photoprism, however it is related to the discussed problem here.
There still seems to be a general issue in the rotation behavior with the combination of android 13 and installed PWAs running in their customized Chrome window.

Does anyone know the place where this issue is to be reported - it could be a bug in Android or Chrome - Android.

Cheers!

@lastzero
Copy link
Member

lastzero commented Oct 20, 2023

@JhonnyJason If you are unsure about the exact cause of a problem, it is best to discuss it here first (or in a generic Android/Chrome forum): https://github.com/photoprism/photoprism/discussions

For example, if installed apps are still having issues, you may need to remove and reinstall them, because the file containing our fix is cached by the operating system (in this case Android) and there is nothing we can do to clear this cache for you.

@JhonnyJason
Copy link

@lastzero Thanks for the fast reply. However my problem is unrelated to Photoprism. So I'm sure it is off-topic here^^.

However I thought you or somebody here might know the place where to report it - I'm not sure about if chromium, or the Android open Source Project are really the right place...

There is definitely a bug in Chrome Android on Android 13

@Massi-X
Copy link

Massi-X commented Oct 20, 2023

@JhonnyJason i suggest the chrome chromium bug tracker, I previously reported some issues and they were helpful. As soon as you created it, please link it here so we can star it too

@JhonnyJason
Copy link

@Massi-X Reported!
Here is the link: https://bugs.chromium.org/p/chromium/issues/detail?id=1494297

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Available in the stable release ux Impacts User Experience
Projects
Status: Release 🌈
Development

No branches or pull requests