Closed Bug 1635640 Opened 6 years ago Closed 3 years ago

window.matchMedia('(prefers-color-scheme: dark)') returns incorrect result for new tab

Categories

(Core :: Widget: Cocoa, defect, P3)

76 Branch
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: ericchen098, Unassigned)

References

(Blocks 1 open bug)

Details

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

Steps to reproduce:

Note: This only happens (but always happens) for the first new tab that is opened.

I'm on a Macbook (MacOS Catalina v10.15.2).

  1. Go to Mac System Preferences -> General.
  2. If Appearance is set to "Light", change it to "Dark". If the Appearance is set to "Dark", change it to "Light".
  3. Open a new tab in Firefox.
  4. Go to youtube.com and open the developer console there.
  5. Run the javascript window.matchMedia('(prefers-color-scheme: dark)').matches.

Actual results:

Running the code in step (5) will always yield the incorrect result.

If you switched your Appearance to "Dark", then the result will be false.
If you switched your Appearance to "Light", then the result will be true.

Expected results:

If you switched your Appearance to "Dark", then the result should be true.
If you switched your Appearance to "Light", then the result should be false.

Component: Untriaged → DOM: CSS Object Model
Product: Firefox → Core

Works fine on Ubuntu 20.04, it seems like an issue in the Cocoa backend.

Component: DOM: CSS Object Model → Widget: Cocoa
Priority: -- → P3

Because this bug's Severity has not been changed from the default since it was filed, and it's Priority is P3 (Backlog,) indicating it has been triaged, the bug's Severity is being updated to S3 (normal.)

Severity: normal → S3
Blocks: catalina
See Also: → 1558086
Summary: window.matchMedia returns incorrect result for new tab → window.matchMedia('(prefers-color-scheme: dark)') returns incorrect result for new tab

This works fine now afaict, on all platforms. Please reopen and ni? me if that's not the case.

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME

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

This works fine now afaict, on all platforms. Please reopen and ni? me if that's not the case.

See bug 1815764

Status: RESOLVED → REOPENED
Ever confirmed: true
Flags: needinfo?(emilio)
Resolution: WORKSFORME → ---
See Also: → 1815764

That doesn't seem the same issue. Will comment there.

Status: REOPENED → RESOLVED
Closed: 4 years ago3 years ago
Flags: needinfo?(emilio)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.