Closed Bug 1917034 Opened 1 month ago Closed 26 days ago

forced-color-adjust: none does not prevent color-scheme to be set to normal when @media (forced-colors: active)

Categories

(Core :: CSS Parsing and Computation, defect, P3)

defect

Tracking

()

RESOLVED FIXED
132 Branch
Tracking Status
firefox132 --- fixed

People

(Reporter: nchevobbe, Assigned: emilio)

References

(Blocks 1 open bug)

Details

(Keywords: parity-edge)

Attachments

(2 files)

On https://codepen.io/nchevobbe/pen/GRbPKwG?editors=1100 , with High Contrast Mode enabled:

  • in Edge, the second div has a brown background and a white text
  • in Firefox, both divs have a beige background and black text. In the Inspector Computed panel. The computed property value for color-scheme is normal

The source of the pen looks something like:

<style>
div {
    background-color: light-dark(beige, brown);
    color: light-dark(black, white);
    forced-color-adjust: none;
}
div:first-of-type {
    color-scheme: light;
}
div:last-of-type {
    color-scheme: dark;
}
</style>
<div>Light</div>
<div>Dark</div>

I think that is is causing some issue with (experimental) Hight Contrast Mode support in DevTools (Bug 1916723)

Does swapping the order of these two lines fix the issue?

Flags: needinfo?(nchevobbe)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #1)

Does swapping the order of these two lines fix the issue?

Yes, the following fixes the issue for the codepen test case, as well as Bug 1916723

diff --git a/servo/components/style/properties/cascade.rs b/servo/components/style/properties/cascade.rs
--- a/servo/components/style/properties/cascade.rs
+++ b/servo/components/style/properties/cascade.rs
@@ -809,10 +809,11 @@ impl<'b> Cascade<'b> {
         #[cfg(feature = "gecko")]
         apply!(FontSizeAdjust);
 
-        apply!(ColorScheme);
         #[cfg(feature = "gecko")]
         apply!(ForcedColorAdjust);
 
+        apply!(ColorScheme);
+
         // Compute the line height.
         apply!(LineHeight);
     }
Flags: needinfo?(nchevobbe)
Flags: needinfo?(emilio)
Blocks: hcm
Flags: needinfo?(emilio)

It is one of the skipped-on-forced-colors properties.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P3
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/eb89b49d2e7e Apply color-scheme after forced-color-adjust. r=firefox-style-system-reviewers,zrhoffman https://hg.mozilla.org/integration/autoland/rev/88b058cb5bfc Remove some related always-on prefs. r=firefox-style-system-reviewers,zrhoffman
Status: ASSIGNED → RESOLVED
Closed: 26 days ago
Resolution: --- → FIXED
Target Milestone: --- → 132 Branch
Pushed by mkmelin@iki.fi: https://hg.mozilla.org/comm-central/rev/f2596b03fccf Adjust Thunderbird code for "Remove some related always-on prefs.". rs=bustage-fix DONTBUILD
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: