Open Bug 2087452 Opened 18 days ago Updated 11 days ago

Disable color scheme emulation when a single page color scheme is forced via <meta name=color-scheme>

Categories

(DevTools :: Inspector: Rules, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: nchevobbe, Unassigned)

Details

Attachments

(1 file)

Attached file test_case.html —

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

https://searchfox.org/firefox-main/rev/86136a5faf970e59063cd07b822717f6fd03a958/devtools/client/inspector/rules/rules.js#807-814

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.");
}

https://searchfox.org/firefox-main/rev/86136a5faf970e59063cd07b822717f6fd03a958/devtools/server/actors/inspector/walker.js#353-356

rfpCSSColorScheme: ChromeUtils.shouldResistFingerprinting(
  "CSSPrefersColorScheme",
  null
),
Attachment #9671616 - Attachment mime type: text/plain → text/html
Type: defect → task
Whiteboard: [devtools-triage]

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.

Severity: -- → S3
Type: task → defect
Priority: -- → P3
Whiteboard: [devtools-triage]

(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.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: