Closed Bug 1741009 Opened 3 years ago Closed 3 years ago

matchMedia event listener won't fire on OS color theme change

Categories

(Firefox :: Theme, defect)

Firefox 95
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: mashy426, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:95.0) Gecko/20100101 Firefox/95.0

Steps to reproduce:

  1. Run a script that uses
    matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (event) => console.log(event.matches)); to output a boolean to the web console that indicates whether the OS color theme is dark (true) or light (false) upon change.
  2. Change the OS color theme.

Actual results:

The event listener does not fire in Firefox Developer Edition 95.0b6 on macOS. However, it does in Firefox 94.0.1 on macOS.

Expected results:

The event listener should have fired in Firefox Developer Edition 95.0b6, as it has in previous 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

Expected change from: "Bug 1529323 - Make prefers-color-scheme respect the Firefox theme rather than the system theme"

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Depends on: 1529323
Resolution: --- → WORKSFORME
Flags: needinfo?(mashy426)

How can this be resolved?

By preventing this event just to prevent the firefox theme from changing its against convention of the event.
The event should be fired so the site / app loaded in the window can respond and change their style etc if desired regardless of whether the firefox UI chooses to do so or not.

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