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

Invalid display-mode media feature #431

Open
PRR24 opened this issue Dec 4, 2023 · 7 comments
Open

Invalid display-mode media feature #431

PRR24 opened this issue Dec 4, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@PRR24
Copy link

PRR24 commented Dec 4, 2023

Description

PWA always reports back @media (display-mode: browser).

Steps to Reproduce

  1. Install a PWA with "display": "standalone" in the manifest
  2. Launch PWA
  3. @media (display-mode: standalone) is false and @media (display-mode: browser) is true even if there are no browser controls visible.

Environment

Ubuntu 20.04
FF 120
PWAsForFirefox 2.9.0

@PRR24 PRR24 added the bug Something isn't working label Dec 4, 2023
@filips123
Copy link
Owner

Unfortunately, I think it's not possible to implement this, as there currently doesn't seem to be a way to change the display mode with internal Firefox JS APIs.

@filips123 filips123 changed the title Invalid display-mode Invalid display-mode media feature Dec 8, 2023
@atjn
Copy link

atjn commented Jan 11, 2024

I think this should be solved by patching the Firefox runtime that is used to run the app. Maybe you can borrow some patches from the old SSB feature.

Maybe it is even possible to get this patched upstream in Firefox? If the browser displays minimal UI, it might as well report display-mode: standalone.

There is also a horrendous no-good solution. You could scan through all the website's loaded CSS and find all media queries that test for display-mode: standalone, then replace them with display-mode: browser and vice-versa. This is possible via the CSSOM.

@filips123
Copy link
Owner

I think this should be solved by patching the Firefox runtime that is used to run the app. Maybe you can borrow some patches from the old SSB feature. Maybe it is even possible to get this patched upstream in Firefox?

Well, it seems the old SSB didn't even support display-mode: standalone.

The problem is that I think it's not possible to control the display mode with internal Firefox JS APIs, so the only option seems to be actual C++ changes. And in this case, they would need to be upstreamed because otherwise, I would have to fork Firefox, and configure all build, update and other infrastructure, which I don't want to do (and because this would also prevent users from using other Firefox forks).

One problem with upstreaming such C++ changes is that Mozilla needs to accept them. So, they probably need to be more generic and not really specific to PWAsForFirefox. They accepted my previous patches for changing the window class/name on Linux with an attribute (for #80), so it seems it's doable.

For this case, an internal JS API to set (all/most) media queries could probably be added in the form of XPCOM interface. And in case support for changing all media queries isn't easily doable, I hope support specifically for display-mode would still be fine (they seem to have a similar API on Android, although it makes more sense there as Firefox for Android supports PWAs). I don't know if this should be added as a new XPCOM interface or to an existing one, or if there are already existing APIs that can change some other media queries and could be used as a basis.

So, these things still need to be researched, and this may also require some help from Firefox developers. I may also try to do this at some point in the future.

There is also a horrendous no-good solution.

Yeah, this isn't really good, and probably also won't work for websites that check media queries with JS.

@asjl
Copy link

asjl commented Mar 30, 2024

I'm seeing this problem with display: minimal-ui as well (which isn't surprising).

Really all I want is a "back" button (and maybe a "reload" button) in the header a la Chrome!

A fix would be nice

@filips123
Copy link
Owner

This issue is about setting the correct display-mode media feature value to the website. Even when it is fixed, it won't affect how the titlebar is displayed, as that can already be customized by the user.

If you want to have back, forward and reload buttons in the titlebar, you can just go to the customize page (Menu -> More tools -> Customize toolbar), and drag these buttons to the titlebar. You can also disable other existing widgets if you want more minimal taskbar.

@asjl
Copy link

asjl commented Mar 30, 2024 via email

@filips123
Copy link
Owner

Oh, so you want the back button to be displayed by the website when it is installed as PWA? Yeah, that's currently not possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: On Hold
Development

No branches or pull requests

4 participants