darkreader: [Bug] System color scheme does not work on Firefox

Bug Report

Bug Description

Extension never activates dark mode when Automation is set to Use system color scheme. It works fine with the other 2 automation modes.

Steps To Reproduce

  • On any website (e.g. mozilla.org)
  • Activate “Use system color scheme”
  • Make sure your system’s theme is in dark mode
  • Observe as no dark mode is applied

Expected Behavior

  • The extension’s dark mode is applied

Actual Behavior

  • The extension’s dark mode is not applied

Screenshots

1 2 3
1 2 3

System Information

  • OS: macOS 12.5
  • Browser: Firefox Dev 104.0b9
  • Dark Reader Version: 4.9.55

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (17 by maintainers)

Most upvoted comments

I feel like I owe you the complete story:

On Aug 9, I was testing Dark Reader for an upcoming release and noticed that Chrome was not firing matchMedia events in background page. Then I tested Firefox under the same conditions and it was fine, so we released Firefox build, postponed Chrome release. (Link to developer-only chat) Then I created #9526 which activated color change listeners in all builds (including Chrome MV2 and Firefox). This approach worked well in Chrome MV3 build before, so I expected it to work fine in other builds (and it did in Chrome MV2 build). Firefox did not like it (#9540). In #9554, we added filtering for excessive messages on Chrome (as a precaution) and made Firefox ignore them entirely as a fix. We disabled these messages on Firefox because I believed Firefox backgrounds were getting color change messages reliably. (Side note: we have a workaround for a different bug on Firefox which makes initial color scheme inaccurate, but did not prevent change events from firing.)

Possible fix: I believe we can re-enable these messages again for Firefox (hopefully, without triggering #9540 because we filter out excessive messages). I would really appreciate if you could help me test the fix before release. Also, I would appreciate if you could test fix on Google Search video results specifically, as explained here.

Probably related and very recent: #9533