Disable color scheme emulation when a single page color scheme is forced via <meta name=color-scheme>
Categories
(DevTools :: Inspector: Rules, defect, P3)
Tracking
(Not tracked)
People
(Reporter: nchevobbe, Unassigned)
Details
Attachments
(1 file)
|
482 bytes,
text/html
|
Details |
With layout.css.prefers-color-scheme.meta-tag.enabled, if you navigate to the attached test case, open devtools and try to simulate light mode on the page, it won't do anything, because it has <meta name="color-scheme" content="dark">
For such case, i.e. pages with the meta, and the content value being light/dark/only light (note that only dark is not valid), we should disable the emulation buttons, like we do when finger printing protection is enabled
const { rfpCSSColorScheme } = this.inspector.walker;
if (rfpCSSColorScheme) {
this.#colorSchemeLightEmulationButton.setAttribute("disabled", true);
this.#colorSchemeDarkEmulationButton.setAttribute("disabled", true);
this.#colorSchemeLightRadio.setAttribute("disabled", true);
this.#colorSchemeDarkRadio.setAttribute("disabled", true);
console.warn("Color scheme emulation is disabled in RFP mode.");
}
rfpCSSColorScheme: ChromeUtils.shouldResistFingerprinting(
"CSSPrefersColorScheme",
null
),
| Reporter | ||
Updated•18 days ago
|
| Reporter | ||
Updated•18 days ago
|
| Reporter | ||
Updated•18 days ago
|
Comment 1•13 days ago
|
||
cc Sasha if we should consider discussing this on the spec side for BiDi. We can't easily reject the command but maybe we should surface the issue in one way or another (eg a log to begin with on the implementation side).
On the devtools side, we still need to clarify in which cases the emulation can't work so this is not a good candidate for a mentored bug. A platform feature to expose this would be nice.
Comment 2•11 days ago
•
|
||
(In reply to Julian Descottes [:jdescottes] from comment #1)
cc Sasha if we should consider discussing this on the spec side for BiDi. We can't easily reject the command but maybe we should surface the issue in one way or another (eg a log to begin with on the implementation side).
Thanks for looping me in!
I think it makes sense to discuss on the spec side, because it's not very obvious what the best strategy is here (but we can start with a log message).
I'll create an issue.
Alright, I actually read the spec this time. According to it, for BiDi we actually override the result of evaluating the media feature (not just the user settings). So we have to override even the meta tag value. Looks like we will have to introduce a separate property for BiDi if we want to keep the DevTools behaviour as it's now.
Description
•