[csswg-drafts] [css-color-adjust] [css-color-adjust] Initial value of the color property. (#9274)

emilio has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-color-adjust] [css-color-adjust] Initial value of the color property. ==
Consider this test-case ([live](https://www.software.hixie.ch/utilities/js/live-dom-viewer/saved/11963)):

```html
<!doctype html>
<html style="color-scheme:dark">Root
  <div style="color:red">child div
    <span style="color: initial">what color is this span?</span>
    <span style="color: initial; color-scheme: light">And this?</span>
  </div>
</html>
```

Browsers disagree on what the behavior is:

 * In Firefox and Safari, the initial color value is still black.
 * In Chrome, the initial color behaves like an explicit `CanvasText`.

Right now the specs specify neither behavior.

From https://drafts.csswg.org/css-color-4/#the-color-property:

> Initial: CanvasText

Initial values are generally computed values, which means that you use the default color scheme, which comes from the `<meta name=color-scheme>` tag, absent in this test-case.

But then from https://drafts.csswg.org/css-color-adjust/#color-scheme-effect:

> On the root element, the [used color scheme](https://drafts.csswg.org/css-color-adjust/#used-color-scheme) additionally must affect the surface color of the [canvas](https://www.w3.org/TR/CSS21/intro.html#canvas), the initial value of the [color](https://drafts.csswg.org/css-color-4/#propdef-color) property, and the viewport’s scrollbars.

Which I understand it as "the second span should still have white text".

Test-case with `<meta name=color-scheme>` [here](https://www.software.hixie.ch/utilities/js/live-dom-viewer/saved/11964) for reference.

I think all browser's behavior make some sense in a way, and are reasonably easy to implement (Chromium's behavior _seems_ to be some sort of special-case where they treat `initial` much like `CanvasText`). But the spec behavior is rather weird.

I think Chromium's behavior is the most intuitive and would be ok resolving to do that, but happy to hear other opinions.

@lilles it seems this comes from a647cfd6a8 which seems directly from your spec draft. Is the spec behavior being different from Chromium's behavior intentional? I'm guessing not? :)

cc: @smfr @jfkthame @svgeesus @tabatkins 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9274 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 30 August 2023 11:54:20 UTC