Open Bug 2091022 Opened 10 days ago Updated 8 days ago

System light/dark theme not used in ESR 153 on Rocky 8

Categories

(Core :: Widget: Gtk, defect)

Firefox 153
defect

Tracking

()

UNCONFIRMED

People

(Reporter: NicholasNLM, Unassigned, NeedInfo)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 external file)

Steps to reproduce

  • Upgrade Rocky 8 system via dnf, which changes Firefox from ESR 140.16.0 to ESR 153.6.0
    • Firefox was configured in 140 to use my system theme for dark/light mode (and worked as expected in 140)
      • The system theme was used for the browser window theming as well as the theming of pages viewed in the browser

Troubleshooting info (tried to keep only the relevant details in the output):

Application Basics
------------------

Name: Firefox
Version: 153.6.0esr
Build ID: 20261103124003
Distribution ID: rocky
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:153.0) Gecko/20100101 Firefox/153.0
OS: Linux 4.18.0-553.184.1.el8_10.x86_64 #1 SMP Wed Nov 4 16:22:12 UTC 2026
OS Theme: Adwaita-dark / Adwaita
Multiprocess Windows: 1/1
Fission Windows: 1/1 Enabled by default
Remote Processes: 9
Enterprise Policies: Active
Google Location Service Key: Found
Google Safebrowsing Key: Found
Mozilla Location Service Key: Found
Safe Mode: false
Memory Size (RAM): 23.5 GB
Disk Space Available: 19.7 GB

Remote Features
---------------

Remote Processes
----------------

Type: Socket
Count: 1

Type: Preallocated
Count: 3

Type: Privileged About
Count: 1

Type: RDD
Count: 1

Type: Fork Server
Count: 1

Type: Extension
Count: 1

Type: Utility JavaScript Oracle
Count: 1

Add-ons
-------

Name: Add-ons Search Detection
Type: extension
Version: 3.0.0
Enabled: true
Location: app-builtin-addons
ID: addons-search-detection@mozilla.com

Name: Form Autofill
Type: extension
Version: 1.0.1
Enabled: true
Location: app-builtin-addons
ID: formautofill@mozilla.org

Name: IPP Activator
Type: extension
Version: 0.1
Enabled: true
Location: app-builtin-addons
ID: ipp-activator@mozilla.com

Name: New Tab
Type: extension
Version: 153.6.0
Enabled: true
Location: app-builtin-addons
ID: newtab@mozilla.org

Name: Picture-In-Picture
Type: extension
Version: 1.0.0
Enabled: true
Location: app-builtin-addons
ID: pictureinpicture@mozilla.org

Name: Web Compatibility Interventions
Type: extension
Version: 153.10.0
Enabled: true
Location: app-builtin-addons
ID: webcompat@mozilla.org

Name: System theme — auto
Type: theme
Version: 1.4.2
Enabled: true
Location: app-builtin
ID: default-theme@mozilla.org

Name: Dark
Type: theme
Version: 1.3.4
Enabled: false
Location: app-builtin
ID: firefox-compact-dark@mozilla.org

Name: Firefox Alpenglow
Type: theme
Version: 1.5.3
Enabled: false
Location: app-builtin
ID: firefox-alpenglow@mozilla.org

Name: Light
Type: theme
Version: 1.3.4
Enabled: false
Location: app-builtin
ID: firefox-compact-light@mozilla.org

Legacy User Stylesheets
-----------------------

Active: false
Stylesheets: No stylesheets found

Environment Variables
---------------------

DISPLAY: :10.0
MOZ_DISABLE_WAYLAND: 1
MOZ_ALLOW_DOWNGRADE: 1
MOZ_USE_XINPUT2: 1
MOZ_GRE_CONF: /etc/gre.d/gre64.conf
MOZ_APP_LAUNCHER: /usr/bin/firefox
MOZ_ASSUME_USER_NS: 1
MOZ_LAUNCHED_CHILD:
MOZ_APP_SILENT_START:
XRE_START_OFFLINE:
XRE_RESTARTED_BY_PROFILE_MANAGER:

Remote Settings
---------------

Status: OK

Status:

Status:

Status: Status Date Infos

Remote Experiments
------------------

Important Modified Preferences
------------------------------

browser.contentblocking.category: custom
browser.sessionstore.upgradeBackup.latestBuildID: 20261103124003
browser.startup.homepage_override.buildID: 20261103124003
browser.startup.homepage_override.mstone: 153.6.0
browser.toolbars.bookmarks.visibility: always
browser.urlbar.placeholderName: Google
browser.urlbar.quicksuggest.migrationVersion: 7
dom.forms.autocomplete.formautofill: true
extensions.lastAppVersion: 153.6.0
media.gmp-manager.buildID: 20261103124003
media.gmp-manager.lastCheck: 1794238365
media.gmp-manager.lastEmptyCheck: 1794238365
media.gmp.storage.version.observed: 1
network.cookie.CHIPS.lastMigrateDatabase: 2
network.cookie.validation.lastEpoch: 1
privacy.bounceTrackingProtection.hasMigratedUserActivationData: true
privacy.clearOnShutdown_v2.formdata: true
privacy.sanitize.clearOnShutdown.hasMigratedToNewPrefs3: true
privacy.sanitize.pending: [{"id":"newtab-container","itemsToClear":[],"options":{}}]
privacy.trackingprotection.allow_list.baseline.enabled: false
privacy.trackingprotection.allow_list.convenience.enabled: false
privacy.trackingprotection.allow_list.hasMigratedCategoryPrefs: true
services.sync.declinedEngines:
services.sync.engine.addresses.available: true

Important Locked Preferences
----------------------------

browser.fixup.fallback-to-https: false
browser.tabs.groups.smart.userEnabled: false
browser.urlbar.trimHttps: false
browser.urlbar.trimURLs: false
dom.block_download_insecure: false
dom.disable_open_during_load: false
dom.security.framebusting_intervention.enabled: false
dom.security.https_only_mode: false
extensions.formautofill.addresses.enabled: false
extensions.formautofill.creditCards.enabled: false
fission.autostart.session: true
identity.fxaccounts.enabled: false
media.utility-process.enabled: true
network.cookie.cookieBehavior: 0
network.cookie.cookieBehavior.pbmode: 5
network.trr.mode: 5
privacy.fingerprintingProtection: false
privacy.fingerprintingProtection.pbmode: false
privacy.trackingprotection.cryptomining.enabled: false
privacy.trackingprotection.enabled: false
privacy.trackingprotection.fingerprinting.enabled: false
privacy.trackingprotection.pbmode.enabled: false
security.enterprise_roots.enabled: true
security.OCSP.enabled: 0
signon.autologin.proxy: false
signon.firefoxRelay.feature: off
signon.includeOtherSubdomainsInLookup: false
signon.management.page.breach-alerts.enabled: false

Actual results

After upgrading, Firefox displayed in light mode, even though I didn't change any GNOME settings.

This impacted two types of themes:

  • the "website appearance" theme (within Settings -> Appearance" (set to "System")
  • the browser theme (within "Extensions and Themes -> Themes" (set to "System theme - auto")

The settings within Firefox didn't change, but it appears as if Firefox is ignoring my GNOME settings in 153 ESR.

Expected results

Firefox should have continued to respect the system themes for light/dark mode.

The Bugbug bot thinks this bug should belong to the 'Core::Privacy: Anti-Tracking' component, but is not confident enough to move the bug to that component.

Component: Untriaged → General
Component: General → Settings UI

This is GTK widget code, not Firefox frontend, so it probably belongs in Core :: Widget: Gtk. The cause is most likely bug 1968664 (landed in 141, so new to anyone moving from ESR 140 to ESR 153).

Cause. In nsLookAndFeel.cpp, RecomputeDBusAppearanceSetting() now treats the portal's color-scheme value 0 ("no preference") as Light. Before 141 it meant "no answer", and Firefox fell back to the GTK theme. GNOME 3.32 on Rocky/RHEL 8 has no color-scheme setting at all, so its portal can presumably only send 0. That value is then returned by ComputeColorSchemeSetting(). Two things follow: SystemUsesDarkTheme skips the mSystemTheme.mIsDark fallback, and ConfigureFinalEffectiveTheme() switches from Adwaita-dark to the light alternative ("OS Theme: Adwaita-dark / Adwaita" in comment 0). Similar reports (bug 1978639, bug 1970124) were closed INVALID, but those desktops did offer a dark-mode setting through the portal. GNOME 3.32 doesn't, so the user has nothing to change.

Fix (for the Widget: Gtk owners to decide). Keep 0 as a distinct "no preference" value. For that value only, use dark when the GTK theme's name is a dark variant. The -dark/-darker/_Dark list in ConfigureAltTheme() could become a shared helper for this. Do not use mSystemTheme.mIsDark. It already includes gtk-application-prefer-dark-theme, which is the KDE case bug 1968664 was fixing. This check has to run after mSystemTheme.Init() in Initialize(), because ComputeColorSchemeSetting() runs before the theme is read and would see a stale or empty theme name. No existing test covers this portal handling.

To confirm: @reporter, please attach the output of a run with MOZ_LOG=LookAndFeel:5. The "dbus settings query result" line should show 'color-scheme': <uint32 0>. Workaround: set widget.use-xdg-desktop-portal.settings to 0 in about:config and restart. Firefox then ignores the portal and follows the GTK theme again.

Suggested severity: S3. On GNOME 3.x enterprise desktops, the dark system theme is ignored for both browser UI and web pages after the ESR upgrade, but nothing breaks and an about:config pref restores the old behavior.


If you'd like to provide feedback on this comment, please use the 👍 or 👎 reaction.
If you want to categorize your feedback you can add one of the following tags: ai-triage-{wrong-file, wrong-cause, hallucination, out-of-scope, not-a-bug, wrong-fix, shallow-fix, wrong-severity}.

Needinfo hackbot@mozilla.tld to have a patch generated for this bug, include any questions or directions as needed in your comment.

Thanks for filing this! It does look like a workaround would be to:

  1. Go to about:config
  2. Search for widget.use-xdg-desktop-portal.settings
  3. Set that value to 0
  4. Restart the browser.

If you're able to, if you can set MOZ_LOG=LookAndFeel:5 and then run and close the browser, the log should show:

  • "dbus settings query result" with something like `'color-scheme': <uint32 0>

Please attach that log for help in further debugging of this issue, thanks!

Component: Settings UI → Widget: Gtk
Flags: needinfo?(nicholas.j.natale)
Product: Firefox → Core

Here's the snippet from running with MOZ_LOG set:

[Parent 49746: Main Thread]: D/LookAndFeel dbus settings query result: ({'org.freedesktop.appearance': {'color-scheme': <uint32 0>}},)
[Parent 49746: Main Thread]: D/LookAndFeel dbus settings query result after unbox: {'org.freedesktop.appearance': {'color-scheme': <uint32 0>}}

I've set widget.use-xdg-desktop-portal.settings but unfortunately I do not see any change after restarting the browser. I also deleted the entire config/profile folder to "reset" (followed by setting widget.use-xdg-desktop-portal.settings again) and still don't see any change.

I've attached the entire log output after changing the setting above in about:config.

Flags: needinfo?(nicholas.j.natale)
Attached file ff_ui_log.txt —

Since bug 1968664, a portal color-scheme of 0 ("no preference") is treated as Light. Desktops without a dark style setting, like GNOME 3.x on RHEL/Rocky 8, always report 0. So with a dark GTK theme such as Adwaita-dark, Firefox switched both the browser UI and web content to light.

Keep 0 as a distinct value. In that case, use dark only if the GTK theme name is a dark variant (-dark/_Dark/... suffixes, shared with ConfigureAltTheme()). Do not use gtk-application-prefer-dark-theme, so the KDE case fixed in bug 1968664 keeps working. The value now depends on mSystemTheme.mName, so it is computed in Initialize() after mSystemTheme.Init().

Choice for reviewers: on GNOME >= 42, if the style is "Default" but the gtk-theme setting is still a legacy "*-dark" theme, Firefox now follows the dark GTK theme, as it did before 141.

Severity: -- → S4

Are there any other potential workarounds for this in the meantime?

If that worked on 140 can you use mozregression to find the broken commit?
https://fedoraproject.org/wiki/How_to_debug_Firefox_problems#Use_Mozregression_tool
Thanks.

Flags: needinfo?(nicholas.j.natale)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: