Skip to content

Commit 447e4de

Browse files
committed
[mediaqueries-5] Per WG resolution, embedded SVGs use the used color scheme of the embedding node for prefers-color-scheme. w3c#7213
1 parent 81dc333 commit 447e4de

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

mediaqueries-5/Overview.bs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3041,6 +3041,34 @@ Detecting the desire for light or dark color schemes: the 'prefers-color-scheme'
30413041
so that 'prefers-color-scheme' reflects preferences appropriate to the medium
30423042
rather than preferences taken out of context.
30433043

3044+
If evaluated in an embedded SVG document
3045+
using the "Secure Animated" embedding mode,
3046+
the preferred color scheme must reflect the value of the [=used color scheme=]
3047+
on the embedding node in the embedding document.
3048+
3049+
<details class=note>
3050+
<summary>Why do this?</summary>
3051+
3052+
While the outermost document needs to get the user's preference directly,
3053+
it's more useful for an embedded document
3054+
to use the color scheme of its surrounding embedding context,
3055+
so it matches the surrounding content.
3056+
3057+
However, this enables communication
3058+
from the embedding document to the embedded document,
3059+
so it's currently restricted to SVG's
3060+
using the "Secure Animated" mode,
3061+
which can't load external resources
3062+
or run script,
3063+
and thus can't respond to the color scheme
3064+
in any way observable to the outside world.
3065+
3066+
Whether or not to do similar for iframes,
3067+
and under what conditions,
3068+
is being discussed in
3069+
<a href="https://github.com/w3c/csswg-drafts/issues/7213/">Issue 7213</a>.
3070+
</details>
3071+
30443072
<div class=note>
30453073
This feature, like the other 'prefers-*' features,
30463074
previously had a <css>no-preference</css> value

0 commit comments

Comments
 (0)