[csswg-drafts] [css-mediaqueries] Clarify propagated preferred color-scheme on elements with color-scheme: normal and no color-scheme meta tag (#7526)

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

== [css-mediaqueries] Clarify propagated preferred color-scheme on elements with color-scheme: normal and no color-scheme meta tag ==
In https://github.com/w3c/csswg-drafts/issues/7213 we resolved for the preferred color-scheme for SVG images to be context dependent.

However what "context dependent" means can be a bit fuzzy. The way I implemented it in Firefox is using the [used color-scheme](https://drafts.csswg.org/css-color-adjust/#color-scheme-prop).

That's usually fine, but for pages which don't use the `color-scheme` property or meta-tag it is a subtle behavior change, because all the SVG images become light (rather than the previous behavior, which is using the OS preferred color-scheme).

@progers mentioned that they have data that indicates that usage of the `prefers-color-scheme` media query is much higher than the color-scheme property / meta tag, and we've seen one case of breakage already: https://bugzilla.mozilla.org/show_bug.cgi?id=1779874

I think it'd be better to deal with this case a bit more subtly. Proposed behavior:

 * If there's a non-normal `color-scheme` property or meta tag, then use that color-scheme to propagate to SVG images.
 * Otherwise use the preferred color-scheme of the document (whatever `prefers-color-scheme` matches), rather than the "used color scheme" which would be light.

I think this makes sense because we're propagating a preference, rather than the used-color-scheme (so propagating the parent page preference for the normal case makes sense). For our internal use cases in Firefox it didn't quite matter because all internal pages support both light and dark mode.

I think this would be similarly-sensible behavior, and a bit more backwards-compatible. It means that we need to provide that extra definition ("effective color-scheme preference" or something?) on the spec.

Thoughts? cc @lilles @progers @smfr @tabatkins

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


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

Received on Friday, 22 July 2022 20:03:09 UTC