Closed Bug 1766244 Opened 2 years ago Closed 2 years ago

Reader mode auto dark vs light theme mode doesn't always stay in automatic mode / doesn't follow future system theme changes

Categories

(Toolkit :: Reader Mode, defect)

Firefox 99
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: nekohayo, Unassigned, NeedInfo)

References

Details

User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0

Steps to reproduce:

As per bug #1594828, in about:config :

reader.improvements_H12022.enabled = True
reader.color_scheme = auto

(or set it using the Auto button in the reader mode settings UI)

Actual results:

It works... most of the time. For some reason I don't quite understand, sometimes when my system/firefox theme changes again, reader.color_scheme gets set to "dark" or "light" and remains so.

Expected results:

If set to "auto", reader.color_scheme should stick/remain at "auto" under all circumstances and the reader style should switch to reflect the latest changes.

I'm not sure what triggers this bug / why it happens for me sometimes, but it may have something to do with suspend/resume. I'm running Firefox on Fedora Linux with GNOME 41, and have been using this extension to switch between the "Adwaita" and "Adwaita-dark" themes (so I'm not yet running GNOME 42+ with its different dark mode implementation), and it works fine if I switch between light/dark theme right now, so I'm suspecting that the issue has something to do with suspend/resume or timing somehow.

The Bugbug bot thinks this bug should belong to the 'Core::Widget: Gtk' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core

Emilio, any idea here?
Thanks.

Flags: needinfo?(emilio)
Priority: -- → P3

I haven't been able to repro this but if the pref is changing this is in the wrong component.

Component: Widget: Gtk → Reader Mode
Flags: needinfo?(emilio)
Priority: P3 → --
Product: Core → Toolkit
See Also: → 1594828

It looks like it may have something to do with this code? https://searchfox.org/mozilla-central/rev/dc09246dfbfd8dafeb6d55ebee18a6294d525443/toolkit/components/reader/AboutReader.jsm#186-202

Micah / Niklas, since you reviewed this code could you take a look and see if it is performing as intended?

Flags: needinfo?(nbaumgardner)
Flags: needinfo?(mtigley)

The "auto" theme reads the content theme of the browser so if you're switching between a light and dark theme that could explain Reader Mode switching between light and dark. But that shouldn't set reader.color_scheme to something other than "auto".

If you flip reader.improvements_H12022.enabled to false it will switch reader.color_scheme to light theme though.

I don't know how reader.color_schemewould be changed other than that though.

Flags: needinfo?(nbaumgardner)

(In reply to Niklas Baumgardner [:niklas] from comment #5)

The "auto" theme reads the content theme of the browser so if you're switching between a light and dark theme that could explain Reader Mode switching between light and dark. But that shouldn't set reader.color_scheme to something other than "auto".

If you flip reader.improvements_H12022.enabled to false it will switch reader.color_scheme to light theme though.

I don't know how reader.color_schemewould be changed other than that though.

The code that I linked to does change the reader.color_scheme code, specifically lines 192, 202, and 811 on https://searchfox.org/mozilla-central/rev/dc09246dfbfd8dafeb6d55ebee18a6294d525443/toolkit/components/reader/AboutReader.jsm. Can you take another look that this is as we intended?

Flags: needinfo?(mtigley) → needinfo?(nbaumgardner)

I'm unable to reproduce this so I'm not seeing anything unusual on lines 192, 202, and 811.

Flags: needinfo?(nbaumgardner)

Hey apologies for the delay looking at this, adding this to my queue

Flags: needinfo?(mtigley)

Looking into this a bit, I don't immediately see why the reader.color_scheme pref would change to something other than "auto" unless:

  1. the user is setting light/dark theme themselves from the reader mode toolbar/about:config
  2. reader.improvements_H12022.enabled is turned off when reader mode is initialized

We have a listener for the "change" event whenever the color scheme media query changes. But this only sets the color scheme of the document and not the preference itself.

Jeff Fortin, are you still seeing this issue on your end? Are you able to report any messages in the browser console when this issue occurs?

Flags: needinfo?(mtigley) → needinfo?(nekohayo)

Unfortunately without more details there isn't much we can do here.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.