Bug 243665 - CSS `color-scheme` can't be assigned via CSS variable
Summary: CSS `color-scheme` can't be assigned via CSS variable
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-08 05:45 PDT by Thomas Steiner
Modified: 2022-08-10 17:52 PDT (History)
2 users (show)

See Also:


Attachments
Correct behavior in Chrome (255.35 KB, image/png)
2022-08-08 05:45 PDT, Thomas Steiner
no flags Details
Incorrect behavior in Safari (186.81 KB, image/png)
2022-08-08 05:46 PDT, Thomas Steiner
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Steiner 2022-08-08 05:45:32 PDT
Created attachment 461482 [details]
Correct behavior in Chrome

It's impossible in Safari to make the following CSS work:

```css
:root {
  --color-scheme: dark light;
  color-scheme: var(--color-scheme);
}
```

Go to https://aboard-bustling-bit.glitch.me/ in Safari and inspect the `<input>` with the value "Just a test". Note how the computed style for the `color-scheme` is always `auto`. Run the same test in Chrome and see how it reflects what is set via `var(--color-scheme)`.
Comment 1 Thomas Steiner 2022-08-08 05:46:05 PDT
Created attachment 461483 [details]
Incorrect behavior in Safari
Comment 2 Tim Nguyen (:ntim) 2022-08-08 21:25:39 PDT
This seems fixed in tip of trunk.
Comment 3 Tim Nguyen (:ntim) 2022-08-08 21:28:14 PDT
I wonder if https://github.com/WebKit/WebKit/commit/5cd7506926c2b38de056ec7dec5c62d1a049c052 fixed it by avoiding applying the property twice.