Skip to content

Commit

Permalink
[mediaqueries-5] Per WG resolution, embedded SVGs use the used color …
Browse files Browse the repository at this point in the history
…scheme of the embedding node for prefers-color-scheme. #7213
  • Loading branch information
tabatkins committed Aug 24, 2022
1 parent 81dc333 commit 447e4de
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions mediaqueries-5/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -3041,6 +3041,34 @@ Detecting the desire for light or dark color schemes: the 'prefers-color-scheme'
so that 'prefers-color-scheme' reflects preferences appropriate to the medium
rather than preferences taken out of context.

If evaluated in an embedded SVG document
using the "Secure Animated" embedding mode,
the preferred color scheme must reflect the value of the [=used color scheme=]
on the embedding node in the embedding document.

<details class=note>
<summary>Why do this?</summary>

While the outermost document needs to get the user's preference directly,
it's more useful for an embedded document
to use the color scheme of its surrounding embedding context,
so it matches the surrounding content.

However, this enables communication
from the embedding document to the embedded document,
so it's currently restricted to SVG's
using the "Secure Animated" mode,
which can't load external resources
or run script,
and thus can't respond to the color scheme
in any way observable to the outside world.

Whether or not to do similar for iframes,
and under what conditions,
is being discussed in
<a href="https://github.com/w3c/csswg-drafts/issues/7213/">Issue 7213</a>.
</details>

<div class=note>
This feature, like the other 'prefers-*' features,
previously had a <css>no-preference</css> value
Expand Down

0 comments on commit 447e4de

Please sign in to comment.