From 447e4de77b87c395ada7266fa9e988a3ad54f4bb Mon Sep 17 00:00:00 2001 From: Tab Atkins-Bittner Date: Wed, 24 Aug 2022 14:30:23 -0700 Subject: [PATCH] [mediaqueries-5] Per WG resolution, embedded SVGs use the used color scheme of the embedding node for prefers-color-scheme. #7213 --- mediaqueries-5/Overview.bs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/mediaqueries-5/Overview.bs b/mediaqueries-5/Overview.bs index f77feaae8fe..25da3da3d45 100644 --- a/mediaqueries-5/Overview.bs +++ b/mediaqueries-5/Overview.bs @@ -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. + +
+ Why do this? + + 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 + Issue 7213. +
+
This feature, like the other 'prefers-*' features, previously had a no-preference value