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

The CSS Working Group just discussed `Propagated preferred-color-scheme on SVG images`, and agreed to the following:

* `RESOLVED: do what Emilio said`
* ``RESOLVED: for the purposes of propagating prefers-color-scheme to the embedded page, if `color-scheme` is `normal` and there's no `color-scheme` meta tag, the propagated scheme is the preferred color-scheme of the embedder document``

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> Subtopic: Propagated preferred-color-scheme on SVG images<br>
&lt;pdr> https://github.com/w3c/csswg-drafts/issues/7526<br>
&lt;astearns> github: https://github.com/w3c/csswg-drafts/issues/7526<br>
&lt;fantasai> emilio: Previous issue, we resolved that preferred-color-scheme on SVG images was going to depend of the color scheme of the embedder element<br>
&lt;fantasai> emilio: what we didn't define is what happened when color-scheme: normal and color scheme is unannotated<br>
&lt;fantasai> emilio: this changes behavior, because used color scheme defaults to light<br>
&lt;fantasai> emilio: no color scheme meta, and color-scheme: normal, used color scheme is light<br>
&lt;fantasai> emilio: so pages that don't annotate it, get light instead of dark<br>
&lt;fantasai> emilio: I think we need another concept that preserves the preferred color scheme of the embedding document<br>
&lt;fantasai> emilio: I think it's a relatively straightforward fix<br>
&lt;fantasai> emilio: Philip prefers not to change the behavior<br>
&lt;fantasai> emilio: I think it's nice that the color scheme would depend on ?<br>
&lt;fantasai> emilio: same for iframes<br>
&lt;fantasai> emilio: I agree that having special cases for SVG, I think we should behave the same way for iframes<br>
&lt;fantasai> TabAtkins: Assuming not security blocked, yes<br>
&lt;fantasai> emilio: So my proposal is splitting used color scheme from preferred color scheme<br>
&lt;fantasai> emilio: propagated preferred color scheme or osmething<br>
&lt;fantasai> emilio: so the default when unannotated isn't light, it's the embedder's color scheme<br>
&lt;pdr> q+<br>
&lt;astearns> ack pdr<br>
&lt;fantasai> pdr: I think it would be useful to step back and consider ?? and ???  atwo differen things<br>
&lt;fantasai> pdr: color-scheme tells the browser how the author wants, and prefers-color-scheme tells us what the OS wants<br>
&lt;emilio> color-scheme and prefers-color-scheme<br>
&lt;fantasai> pdr: the behavior here is clear, the embedder is asking for color scheme<br>
&lt;fantasai> pdr: combine them, gets complicated<br>
&lt;astearns> s/?? and ???/color-scheme and prefers-color-scheme/<br>
&lt;fantasai> pdr: reason is, you can't make color-scheme follow prefers-color-scheme by default<br>
&lt;fantasai> pdr: some websites are designed to have light scrollbars, flip it to dark, it's ugly<br>
&lt;fantasai> pdr: we can't really ignore concepts are tightly intertwined<br>
&lt;fantasai> pdr: given all the issues with SVG and iframe, adds ocmplexity that's not necessary<br>
&lt;emilio> q+<br>
&lt;fantasai> pdr: just have color-scheme be the browser's color scheme and prefers-color-scheme be the OS<br>
&lt;astearns> ack emilio<br>
&lt;TabAtkins> q+<br>
&lt;fantasai> emilio: The reason why I think prefers-color-scheme follow the embedder, otherwise it's useless in embedder and in iframe<br>
&lt;fantasai> emilio: it's not useful to know that OS prefers dark, because you don't care about OS being dark, you care about your context being dark<br>
&lt;fantasai> TabAtkins: yes<br>
&lt;fantasai> TabAtkins: if page said 'color-scheme: dark', SVG should be dark by default<br>
&lt;fantasai> TabAtkins: if they're light, this is a problem<br>
&lt;astearns> ack TabAtkins<br>
&lt;fantasai> TabAtkins: we want to fix this breaking case<br>
&lt;fantasai> emilio: regarding the point of complexity,<br>
&lt;fantasai> emilio: in Gecko you already need to have prefers-color-scheme as a key in the image tag<br>
&lt;fantasai> emilio: I think Blink has similar mechanism<br>
&lt;fantasai> emilio: in terms of complexity, in Gecko it's mostly a one-liner<br>
&lt;fantasai> emilio: I agree it can be difficult to wrap your head around it in the first place, but in terms of implementation complexity<br>
&lt;fantasai> emilio: it's simple to default to document rather than OS color scheme<br>
&lt;fantasai> pdr: If you have SVG content, and embedded, it looks different<br>
&lt;fantasai> TabAtkins: Assuming not cross-origin iframe or other security-conscious spot<br>
&lt;fantasai> TabAtkins: iframe should behave same as image<br>
&lt;fantasai> TabAtkins: should get color scheme passed through<br>
&lt;fantasai> TabAtkins: it's only in cases where we want to restrict cross-origin communication that we cut it off<br>
&lt;fantasai> TabAtkins: ....<br>
&lt;fantasai> TabAtkins: in other cases can exfiltrate, and could od something different<br>
&lt;fantasai> TabAtkins: but in all other cases, want to keep consistency between iframe and other ways of embedding SVGs<br>
&lt;fantasai> pdr: [missed]<br>
&lt;fantasai> TabAtkins: cross-origin iframes restrict in a number of ways<br>
&lt;fantasai> TabAtkins: and CSS doesn't pass much info, mainly width/height<br>
&lt;fantasai> TabAtkins: and we would like to minimize cross-origin info propagation<br>
&lt;dbaron> s/[missed]/is there precedent for developers dealing with situations where APIs work so differently in cross-origin iframes<br>
&lt;fantasai> TabAtkins: in fact we're doing more cross-origin restrictions with (new feature)<br>
&lt;fantasai> TabAtkins: because so restricted, I doubt very surprising for authors<br>
&lt;fantasai> pdr: There's SVGs in ads, and they're frequently mixed in cross-origin contexts<br>
&lt;fantasai> pdr: from user's perspective, will be difficult to tell<br>
&lt;fantasai> pdr: why not specify fully the iframe/<br>
&lt;fantasai> emilio: there's another issue on that<br>
&lt;fantasai> emilio: I talked to security folks about this, and the tldr is they didn't find anything particularly concerning to make it behave the same as SVG<br>
&lt;fantasai> emilio: It's basically depending on Chrome's security folks to take a look to make it behave consistently everywhere<br>
&lt;fantasai> emilio: use cases where exfiltration is a problem, ...<br>
&lt;fantasai> emilio: You can't tell if color-scheme is coming from OS or from page<br>
&lt;fantasai> emilio: if you're loaded in both cross-origin and original context...<br>
&lt;fantasai> emilio: doesn't seem that problematic<br>
&lt;fantasai> emilio: it's one bit that we stop passing from OS and start passing from the page<br>
&lt;fantasai> emilio: later in agenda<br>
&lt;fantasai> emilio: I'm for making all embedding contexts behave consistently in this regard<br>
&lt;fantasai> TabAtkins: I'm operating from idea that we want to lock down crossorigin communication<br>
&lt;fantasai> TabAtkins: but if one more bit is not considered a problem then ok<br>
&lt;fantasai> emilio: My point is that, we stop exposing one bit from OS and start exposing from one page<br>
&lt;bkardell_> q+<br>
&lt;fantasai> emilio: the only way for embedded page to differentiate is if it's also loaded in a different context (top-level or other)<br>
&lt;fantasai> TabAtkins: as long as we're locking down ?<br>
&lt;fantasai> TabAtkins: so long as there is zero ability to coordinate between parties<br>
&lt;fantasai> TabAtkins: then I don't care<br>
&lt;TabAtkins> s/?/cases liked fencedframe/<br>
&lt;bkardell_> q-<br>
&lt;astearns> ack bkardell_<br>
&lt;fremy> q+<br>
&lt;fantasai> astearns: Philip, have your concerns been addressed?<br>
&lt;fantasai> pdr: Would be happier if not a special case<br>
&lt;fremy> q-<br>
&lt;fantasai> pdr: Emilio's proposal is not overall bad<br>
&lt;fantasai> TabAtkins: proposal is we propagate used color scheme to all embedded contexts regardless?<br>
&lt;fantasai> emilio: This is about page with color-scheme: normal, no color scheme meta<br>
&lt;fantasai> emilio: instead of propagating used color scheme, we propagate preferred color scheme of the document<br>
&lt;fantasai> emilio: recursively<br>
&lt;fantasai> TabAtkins: that sounds good<br>
&lt;fantasai> dbaron: please summarize into IRC!<br>
&lt;fantasai> fremy: so idea is on the viewport, if you didn't specify color-scheme, you get the value that you get from the meta tag?<br>
&lt;TabAtkins> proposed resolution: when the embedding page doesn't set color-scheme (or sets it to 'normal'), we don't propagate used color-scheme to embedded pages (they continue to get the OS-derived preferences)<br>
&lt;fantasai> fremy: if you have a web page that does not specify any color scheme property, just using default, it will propagate to iframes the value that is used in the meta tag<br>
&lt;fantasai> emilio: yes, that's how used color scheme alread work<br>
&lt;fantasai> emilio: this case, if on top of that there's no meta, instead of propagating 'light', which is the default used color scheme, you propagate the preferred color scheme of the parent document<br>
&lt;fantasai> emilio: My thought is that instead of using OS preferrence, we use preference of embedding page<br>
&lt;fantasai> emilio: it's usualy OS color scheme, except when you have nested embedding<br>
&lt;fantasai> TabAtkins: Ah, so if top level sets color scheme, second level doesn't, third level gets the top-level scheme<br>
&lt;fantasai> emilio: exactly<br>
&lt;TabAtkins> proposal: if the embedding page doesn't set a color-scheme, it propagates the default color scheme to embedded pages (rather than passing its used color scheme)<br>
&lt;emilio> Proposed resolution: for the purposes of propagating prefers-color-scheme to the embedded page, if `color-scheme` is `normal` and there's no `color-scheme` meta tag, the propagated scheme is the preferred color-scheme of the embedder document<br>
&lt;TabAtkins> (this matters for A->B->C, where A sets 'color-scheme' but B doesn't. In this case, C will get A's used scheme, without B's lack of care (which'll resolve to 'light') affecting it)<br>
&lt;dholbert> TabAtkins: ("default"/"used" might be confusing/ambiguous in your wording)<br>
&lt;fremy> lgtm<br>
&lt;fantasai> fantasai: Sounds good to me, let's resolve<br>
&lt;fantasai> astearns: objections?<br>
&lt;fantasai> RESOLVED: do what Emilio said<br>
&lt;dbaron> RESOLVED: for the purposes of propagating prefers-color-scheme to the embedded page, if `color-scheme` is `normal` and there's no `color-scheme` meta tag, the propagated scheme is the preferred color-scheme of the embedder document<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7526#issuecomment-1201681959 using your GitHub account


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

Received on Monday, 1 August 2022 20:28:48 UTC