color from registered property set with light-dark() have different values in Firefox and Chrome in dark mode
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
People
(Reporter: nchevobbe, Assigned: emilio)
References
Details
Attachments
(2 files)
Steps to reproduce
- Set your OS appearance setting to "dark"
- Open the attached HTML file in both Chrome and Firefox
Expected results
I'm seeing the same result in both browsers
Actual results
In Firefox, the square is red, in Chrome, it's blue.
Here's the CSS:
@property --x {
inherits: true;
initial-value: black;
syntax: "<color>";
}
body {
color-scheme: light dark;
--x: light-dark(red, blue);
}
.swatch {
background-color: var(--x);
}
in Chrome, while in dark mode, the value of --x
does seem to get its value from the second argument of light-dark()
.
Not sure if this is a bug in Firefox or in Chrome, and whether the issue is in @property
or in light-dark
Reporter | ||
Comment 1•4 months ago
|
||
Note that if I'm setting --x
in .swatch
directly, I do get a blue square in Firefox
@property --x {
inherits: true;
initial-value: black;
syntax: "<color>";
}
body {
color-scheme: light dark;
}
.swatch {
--x: light-dark(red, blue);
background-color: var(--x);
}
So I guess something's might be off with how we deal with inherits ?
Assignee | ||
Comment 2•4 months ago
|
||
We're not getting the application order right between color-scheme
and --x
in your first example. We should apply color-scheme
first, then --x
.
Assignee | ||
Comment 3•4 months ago
|
||
This is a bit less complicated than lengths because there's no cycle
possible which could turn the color-scheme declaration invalid afaict.
So it's just that we need to defer the colors when color-scheme is
specified, which is slightly annoying, but maybe not too bad.
Better naming for the flags appreciated, if you have any suggestion...
Updated•4 months ago
|
Comment 6•4 months ago
|
||
bugherder |
Updated•4 months ago
|
Comment 8•3 months ago
|
||
Issue is reproducible on a 2024-05-28 Nightly build on Windows 10.
Verified as fixed on Firefox 128.0b4 and Firefox Nightly 129.0a1 on Windows 10, Ubuntu 22, macOS 14.
Description
•