Closed Bug 1749837 Opened 2 years ago Closed 2 years ago

Firefox 96 automatically switches to dark mode if user's theme uses a light font color

Categories

(Firefox :: Theme, defect)

Firefox 96
Desktop
Unspecified
defect

Tracking

()

VERIFIED FIXED
Tracking Status
firefox-esr91 --- unaffected
firefox96 --- wontfix
firefox97 --- wontfix
firefox98 --- wontfix
firefox99 --- wontfix
firefox100 --- verified

People

(Reporter: fizzwidget, Unassigned)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0

Steps to reproduce:

When I use a theme where the tab_background_text property is a light color. For instance using this theme : https://addons.mozilla.org/fr/firefox/addon/furfox-tail-twister/. Tested with other themes having a light text color and with firefox-color addon. Same issue in any case.
This behavior only happen since Firefox 96.

In french forums, I read some users posts complaining about this (just to say that I'm not alone).

Actual results:

All browser interface switches to dark mode, meaning dark pages, dark menus, dark search_bar, etc.

Expected results:

The light mode should be used by default if the theme doesn't specify using the dark mode. Just like in previous Firefox versions.

The Bugbug bot thinks this bug should belong to the 'Firefox::Theme' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Theme

Hi,
I was able to reproduce this issue on latest Nightly version 98.0a1 (2022-01-13)(64-bit) on Windows 10, Ubuntu 20 and macOS 11.
I've found this Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=c73bcc465e0c2bce7debb0a86277e2dcb27444e4&tochange=60627ac794697e354a3523302c168de12bebb628
I'll change flags accordingly.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Has Regression Range: --- → yes
Has STR: --- → yes
Ever confirmed: true
Hardware: Unspecified → Desktop
Keywords: regression
Regressions: 1741931
Regressed by: 1741931
No longer regressions: 1741931

Set release status flags based on info from the regressing bug 1741931

Looks like the behaviour might be intentional (solution to https://bugzilla.mozilla.org/show_bug.cgi?id=1741931)

"It's easy for themes that have image backgrounds to have bogus
background colors.

Text color should give a better indication of the color-scheme since
it's always used, even with image backgrounds."

Not sure if this solution was so good though. I think it should be assumed that the designer of a theme can see how the menus look like after designing a theme - and we should not try to "read the mind" of a theme designer. It certainly unexpectedly changed the appearance of Firefox/Pages for a lot of users that had a theme installed after the update.

Can you see comment 5 and see if this behavior was intentional?

Flags: needinfo?(emilio)

So it was intentional indeed.

It seems there are some themes (like the one from comment 0) where the heuristics fall a bit short. We have ways to configure this behavior for content (layout.css.prefers-color-scheme.content-override). Having UI for that is bug 1736218 and is being worked on.

The other thing that we should consider, is adding a way to override those heuristics at the theme level. That'd allow themes to customize whether menus and so on are light or dark in the browser UI.

Rob, do you know what the process would be to potentially introduce a color_scheme property on the theme manifest? Is it just a matter of implementing it and documenting it, or is there some sort standards process? I think that'd be a useful thing to have long term. I'm happy to work on it if it seems reasonable to you.

Flags: needinfo?(emilio) → needinfo?(rob)
See Also: → 1736218
See Also: → 1739558

(In reply to Emilio Cobos Álvarez (:emilio) from comment #8)

The other thing that we should consider, is adding a way to override those heuristics at the theme level. That'd allow themes to customize whether menus and so on are light or dark in the browser UI.

That sounds reasonable at first. Is the content color scheme logic able to support tab/window-specific color schemes? The theme API supports dynamic modification of themes, globally and also window-specific themes (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/theme/update).

Rob, do you know what the process would be to potentially introduce a color_scheme property on the theme manifest? Is it just a matter of implementing it and documenting it, or is there some sort standards process? I think that'd be a useful thing to have long term. I'm happy to work on it if it seems reasonable to you.

Modifications to extension APIs usually start in bugs on Bugzilla in the WebExtensions::General component (or any other bug in WebExtensions). We see them during triage and discuss them. Sometimes there is an informal conversation outside of bugs (which we discuss during our standup or internal "office hours" meeting).

For this specific case, I think that it's more a question of whether the desktop/platform themes are willing to introduce this capability. If there is wide support for adjusting content themes based on (third-party) themes, then we (the WebExtensions team) will probably go along with it.

Flags: needinfo?(rob)

Ok, i can try coming up with a proposal. Off-hand per-window color scheme is not possible at least on GTK, i think.

Flags: needinfo?(emilio)

Hello,
In the last comments, I see different suggestions of enhancement for Firefox. That's great but this issue is a regression, all users with a them containing a light color have been forced to use their browser with a dark mode. Using layout.css.prefers-color-scheme.content-override is not a good workaround because the color scheme is not applied to all interface elements and a dark screen can be seen on each page load (with an awful blink effect).
So in a first time, why do not just disabled theme heuristics based on text color in order to wait one of the proposal of dark mode switch will be implemented?

(In reply to fizzwidget from comment #11)

Hello,
In the last comments, I see different suggestions of enhancement for Firefox. That's great but this issue is a regression, all users with a them containing a light color have been forced to use their browser with a dark mode.

Well it's not really a regression other than on Windows, tbh. We already did that, it was a change in the heuristics which triggered this for some themes that arguably are not great.

Using layout.css.prefers-color-scheme.content-override is not a good workaround because the color scheme is not applied to all interface elements and a dark screen can be seen on each page load (with an awful blink effect).

Can you file a separate bug for that with details on how to reproduce it? Feel free to cc me or reply with the link here.

I don't see that locally, but I'd love to dig. I tried to reproduce with the dark theme and layout.css.prefers-color-scheme.content-override=1 (light), but I don't see a flash, backgrounds are always light in content.

So in a first time, why do not just disabled theme heuristics based on text color in order to wait one of the proposal of dark mode switch will be implemented?

Well, we'd have to break some themes like the one in bug 1741931 in order to fix others like the one in comment 0. That sounds like a whack-a-mole to me so I think I'd rather spend time working on bug 1750932 (I just sent a patch + tests for that).

Flags: needinfo?(emilio)
See Also: → 1751088

(In reply to JDCrownover from comment #13)

OK, I came here to complain about this, too. It only started after applying the update to 96.0.2, so why the hell can't you just reverse what you did to cause the problem. I've applied the about:config patch, and now my web pages have white backgrounds again, BUT only after seeing the black background flash on the page. AND menu boxes and such are still showing a black background. SURELY YOU DIDN'T DO THIS ON PURPOSE, so PLEASE fix the damn problem.

The problem you're describing is bug 1751088, and is fixed on Nightly already.

See Also: → 1752860

Fixed via bug 1750932 and bug 1736218

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Flags: qe-verify+
Depends on: 1736218
See Also: 1736218
Attached image 1749837.png

I managed to reproduce the issue on Firefox 99.0.1, under Windows 10x64.
I verified the issue on Firefox 100.0b9, under Windows 10, Ubuntu 21.04 and macOS 10.15.
All 'about' pages are displayed on light theme but I noticed that on the latest Beta build, the Application Menu is displayed on dark theme, and on older builds (eg. 95.0a1) the Application Menu is displayed on light theme after installing the theme under test.
Is this an expected behavior?

Flags: needinfo?(emilio)

Yeah that's the expected behavior for now. The theme author can use color_scheme: light in the theme manifest to change it now.

Flags: needinfo?(emilio)

Based on Comment 16 and Comment 17, I'm marking this issue as verified.

Status: RESOLVED → VERIFIED
Flags: qe-verify+

(In reply to Emilio Cobos Álvarez (:emilio) from comment #17)

Yeah that's the expected behavior for now. The theme author can use color_scheme: light in the theme manifest to change it now.

Hi Emilio,
Sorry to answer a week after Mihai resolved that point. I tried to add color_scheme: light in a theme manifest and application menu, context menu and bookmarks menu are still in dark background.
I'm using the new FF 100.0 (release)

Flags: needinfo?(emilio)

Can you file a new bug, ideally attaching a Json or xpi file that reproduces the issue? Otherwise I can only guess what is going on.

Did you set it inside the properties object? See https://searchfox.org/mozilla-central/rev/997a56b018662e2940c99bbaf57a6ac9d1aa5422/browser/themes/addons/light/manifest.json#59 for an example. Feel free to needinfo me on that bug and I'm happy to take a look.

Flags: needinfo?(emilio)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #20)

Can you file a new bug, ideally attaching a Json or xpi file that reproduces the issue? Otherwise I can only guess what is going on.

Did you set it inside the properties object? See https://searchfox.org/mozilla-central/rev/997a56b018662e2940c99bbaf57a6ac9d1aa5422/browser/themes/addons/light/manifest.json#59 for an example. Feel free to needinfo me on that bug and I'm happy to take a look.

I had a similar issue.

I modified my theme and installed it with Firefox 98. It was tested with the Nightly 100 and worked.
https://addons.mozilla.org/de/firefox/addon/tiger-eyes-turquoise/

After updating to Firefox 100, the menus (application, context) were still dark.
Then I switched to another theme and back and it worked.
Now it works perfectly without any issue.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #20)

Can you file a new bug, ideally attaching a Json or xpi file that reproduces the issue? Otherwise I can only guess what is going on.

Did you set it inside the properties object? See https://searchfox.org/mozilla-central/rev/997a56b018662e2940c99bbaf57a6ac9d1aa5422/browser/themes/addons/light/manifest.json#59 for an example. Feel free to needinfo me on that bug and I'm happy to take a look.

Solved! Indeed when I tried I didn't put the color_scheme setting in the properties object. Thanks a lot for your help!

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: