-
Notifications
You must be signed in to change notification settings - Fork 711
[css-color-adjust-1] more granular overriding of forced colors mode than per-element #4178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I personally disagree with this. |
Yeah, I think making declarations apply or not whether they're in a media query block is pretty confusing. |
@emilio can you expand why you believe such declarations are confusing? The intent of the request is to allow declarations to work as expected inside a media query block, including |
This seems like a dangerous thing to do, anyway. If an author changes foreground but not background colors (or vice versa) based on what they expect a "high contrast" mode to do, it could break very badly in a different forced colors mode. The specific case of being able to indicate grayed text, using system colors, is valid, but is it really that much harder to also set the There's also nothing stopping a UA stylesheet from selecting on ARIA attributes when applying the forced color mode, if you're seeing this problem (ARIA semantics being lost in high contrast) a lot in the wild. |
The ergonomics of setting In the case of components where an author wants to opt-out and have complete control over it (ex. maps widget rendered in Canvas) the property makes complete sense. |
I agree that rules inside an MQ shouldn't be special. In particular, it's hard to know what rules are inside an MQ -- entire style sheets can be imported via several levels of @import indirection through a mediaquery-filtered link. One possible way around this could be the author specifying which properties to except, e.g. |
I assume you mean "shouldn't be special", @fantasai ^_^ But yeah, we've avoided giving special meaning to things inside of MQs for a long time for several reasons, and I think we should continue avoiding that. |
I agree with not making rules inside MQ special. Either something like forced-color-except like fantasai proposes, or could a priority on the declaration be an alternative? |
@tabatkins Uh, yeah. :) Fixed. |
The CSS Working Group just discussed The full IRC log of that discussion<dael> Topic: [css-color-adjust-1] Cascade within forced-colors MQ<dael> github: https://github.com//issues/4178 <dael> Rossen_: Is fantasai on? <dael> Rossen_: I'll introduce. <dael> Rossen_: Brought up by some framework devs when starting to adopt new forced colors MQ and forced colors adjust properties <dael> Rossen_: Feedback is in contrast to previous impl in IE and Edge when used high-contrast and high-contrast-adjust the MQ and the way properties inside MQ evaluate is sign different <dael> Rossen_: Boils down to it's currently...ergonomocs are such that if you decide to adjust a single color properties inside a forced color MQ you have to take over entire styling of elements <dael> astearns: Because the forced color wins of MQ declaration? <dael> Rossen_: NO. Current way to do it is you have to set foced color adjust to none inside the selector in the MQ. Once selected yoru lemeents, set it to none. Means you're taking the entire element and its subtree from forced color being applied <dael> astearns: Why need to say none? <dael> Rossen_: To change border color for ex <dael> astearns: B/c forced color will otherwise override? <dael> Rossen_: Correct. <dael> Rossen_: We have a MQ that detects forced color adjust. Just like in example. When forced colors evaluates active inside MQ you do whatever you want. In this case select disabled = true elements. Wants to set the color of those to gray <dael> Rossen_: To do this today you have to set forced-color adjust to none. Otherwise color would be window color <dael> Rossen_: Making sense? <dael> astearns: Yes <dael> Rossen_: Previous to that high contrast impl we had we allowed individual prop to apply to individual elements. Color for that one property would override. <heycam> q+ <dael> Rossen_: That's the proposal of this change when it started. Since there was discussion between AmeliaBR emilio and fantasai. <dael> Rossen_: fantasai prop which I want to understand better is to do it other way around. Spec properties except ones you want to adjust. So forced colors except in this case border-stroke <dael> Rossen_: Some support to this, but not seeing it recorded <astearns> ack dbaron <dael> astearns: Not sure anyone is agreeing with fantasai prop except something like it need to happen <chrishtr> q+ <dael> dbaron: Was going to say I think a way to frame this is what we want is more granular way to override forced colors. A property that's everything or nothing isn't granular enough. Peopl care about properties or maybe declarations. Maybe makes sense to re-title issue? <dael> dbaron: I think there's a 3rd option, complex, but have it in value of prop rather than sep prop. In hindsight when we have a property that modifies how another works we end up regretting. I think this is like box sizing in that way. But that's a lot of syntaxes to modify. Not sure if there's a more elegent way to do it. <astearns> ack heycam <dael> heycam: I wanted to agree with emilio initial comment finding it confusing if we change depending on what properties are inside. In favor of some opption that makes it more explicit be that fantasai prop or something like dbaron <TabAtkins> q+ <dael> heycam: Question on MQ itself. Does it respond to value of [missed]> Forced color property determines if MQ matches? <dael> chrishtr: I believe prop is not MQ but another property or value that overrides instead. <TabAtkins> So a possible "adjust the value" option is to finally jump into using new ! options. Like `!override-forced-color`, so that *if* this declaration wins the cascade, it's allowed to override a forced color. <dael> astearns: It's an alternative we're discussing but so far no one on thread has liked prop to having MQ allow override <dael> heycam: Question is what determines if the MQ matches. Is it the property that enables forced color adjusting on a subtree? <dael> Rossen_: Request is to enable single properties on selected items to take precedence over forced color <astearns> q? <dael> Rossen_: Target BG color which is set to canvas. If you select a given element within forced color acive MQ we would have allowd bg color to take precedence over forced color. <TabAtkins> Then we switch forced-colors mode to, rather than using the cascade and UA-!important rules, instead just use magic to win the cascade automatically, *unless* the cascade-winning declaration has the appropriate ! on it. <dael> Rossen_: Now to do it you have to first set foced-color-adust to none and take over everything by your self <dael> heycam: Property to turn it to none would that make MQ not match? <dael> Rossen_: NOt really. Mode of browser is still active <dael> heycam: MQ is the overall mode, not individual sub trees where you set htat property <dael> Rossen_: Yeah <dael> heycam: Cool. <TabAtkins> (And because we're using magic, this allows us to handle multiple such override modes in the future, if we introduce them, by internally handling conflicts, rather than trying to rely on the cascade to resolve them.) <dael> astearns: Anything else heycam ? <astearns> ack chrishtr <dael> heycam: No <dael> chrishtr: When you enforce colors mode I think there is no defined spec for what UA does. Right? <dael> Rossen_: Not correct. Spec defining this is css-color-adjustment <dael> chrishtr: Spells out exact stylesheets applied? <astearns> https://www.w3.org/TR/css-color-adjust-1/#forced <Rossen_> https://drafts.csswg.org/css-color-adjust-1/#forced-color-adjust-prop <dael> Rossen_: We have the exact stylsheet? Asking if we define UA stylesheet? <dael> Rossen_: No, we define colors are reverted to system colors. System colors are defined in Colors module <dael> chrishtr: Different than heuristic darkening of page <dael> Rossen_: Yes <dbaron> https://drafts.csswg.org/css-color-adjust-1/#forced-colors-properties is somewhat well-defined, I think <dael> chrishtr: Any override is predictable to dev <dael> Rossen_: Yep <dael> chrishtr: Got it, thank you <astearns> ack TabAtkins <dael> TabAtkins: I wrote stuff in IRC. <dael> TabAtkins: Revisiting dbaron about building funcitonality into property value space. We do have a spot to do that in syntax with guar compat. Using stuff after ! which we only use for one thing. Syntax spec allows for more <dael> TabAtkins: Possible way to address particular properties overriding forced color and to simplify is first switch forced color to magically win cascade regardless of author. THen allow author spec after a ! they override forced color. Say it's explicitly meant even if forced. If it wins cascade it doesn't get overwritten <dael> TabAtkins: Same as figuring out how to insert a new keyword but allows completely consistant regardless of value space. Auto-extensible to future things. As well having forced colors apply magically gives more flexibility if we have to add more things like this <florian> q? <florian> q+ <dael> TabAtkins: THen can have resolution rules based on whatever arbitratry requirements we need. Without having to worry about cascade we let ! and author cascade determine <dael> Rossen_: Question. Your prop is !override after property? <dael> TabAtkins: Yeah <dael> Rossen_: Like it. Pretty cool <dael> TabAtkins: ! value space is allowed multi value so you can do !important override so we're not limiting authors <dael> astearns: Talking about a generic ! override or !over-forced-colors <dael> TabAtkins: More specific one <dael> florian: On one hand what TabAtkins desc makes snese for this and has future extensibility. Does feel a lot like additional cascade origins. Not long ago had prop from miriam about having control over these things. I wonder if we shouldn't try harder to figure out that story. Various levels of cascade origin feels like what we're doing here. Worth exploring before being sure that's not it <Rossen_> ack florian <dael> TabAtkins: DOn't believe it's similar. While UA provided forced colors live on a high cascade, cascade-origins doesn't allow selective override unless we allow opt into even higher cascade. I like my proposal b/c doesn't have author cascade finnagle. They have existing rules and if they happen to be rules that should apply even in case of forced colors you add an indicator vs having a different cascade that auto-wins over another cascade that auto-wins <dael> TabAtkins: You have one instance auto-winning all the time in that case and that may not be what you want <dael> miriam: Agree with TabAtkins. Feels different use case. I'd be willing to dig in further to see if overlap but offhand seems not same problem <Rossen_> q? <dael> astearns: Other opinions? <Rossen_> ack dbaron <dael> dbaron: Reference to custom cascade brought an interesting question. If an author has rules they want to override forced colors and other rules that would normally override them what happens? Do we want that to be possible? Maybe one arg is if author says this overrides forced color it overrides all the other rules. <dael> dbaron: Maybe want authors to do that. SOme of these have confusing outcomes. Might think someone wants it, but may be 1 person wants and 99 are confused. Makes me think maybe more like custom-cascade origins. Maybe this is a little more like cascade. Worth thinking about what we want to allow and what's too confusing <dael> florian: I think we can do 3 things. One is you set super override and always wins. Another is super override doesn't win if you've overwritten it with the normal cascade. Asking for trouble b/c people won't test with forced colors <dael> dbaron: 3 is horrible <dael> TabAtkins: Writing down 1, 2, and 3 would be good <dbaron> 1. color: blue ! override always beats color: red, even if red would normally win the cascade <dael> florian: If you have blue in yoru normal cascade which wins then red !white with specificifity that doesn't win it's still blue. THe red lost alreay. That's 1 <dbaron> 2. color blue ! override and color: red cascade normally, and if red wins in the cascade, then there's no longer an override and the blue just gets ignored <dael> florian: 2 is ! override makes red more important than forced color and more important than blue. Implicitly important <dael> florian: 3 which is bad is if !override-red lioses to blue in normal and over blue and system in forced. <dael> TabAtkins: Agree. 1st is per declaration. 2nd is mega-important. 3rd is bad <dael> dbaron: I think first is mega important <dael> TabAtkins: Do we want to take this with the two good options to the issue? Or decide now? <dael> astearns: Rossen_? <dbaron> Issue discussion, I thnik -- there's a ton of stuff to sort out here. <dael> Rossen_: It's easy to discount option 3. Exploring 2 is interesting but i'm hesitant on mega-important. <TabAtkins> I mean, !mega-important is just Custom Cascade Origins <dbaron> This 1/2/3 thing is a discussion within a discussion. <dael> Rossen_: If we can agree on 1 vs 2 that's a path forward to experiment and see how it works <dael> dbaron: Feel like 1 vs 2 is a discussion in a discussion and there's large points to sort out. Better in the issue <dael> astearns: Can resolve that we'll solve this issue in the value space <dael> TabAtkins: As opposed to properties, yeah <dael> dbaron: When I said value space I wouldn't have counted TabAtkins proposal as there, but I like TabAtkins proposal <dael> Rossen_: I like it as well <heycam> if there are many properties to override to adapt to the forced color mode I wonder if it will be onerous to write an !override on every property declaration <dael> astearns: Let's take it back to the issue for now since we have alternatives and people like emilio and fremy with strong opinions. THen we can hopefully resolve soon. <TabAtkins> (Given a time machine, I'd have proposed adding `!border-box` to the sizing properties, rather than box-sizing. ^_^) <dael> astearns: Any last words? |
The more I think of this, the more I like Fantasai's suggestion of explicitly listing the properties you want to ignore, as the values of a property which cascades normally. Maybe make it The one downside to this is that, like all properties that take a list of values ( |
Summary of the discussion is that dbaron argued that we've historically considered "property A which influences how property B works" as a bad idea; a notable example is 'box-sizing' which is generally considered a legacy mistake. Several people agreed with this. Instead, some sort of addition to the value space of the properties was preferred. I suggested that we finally use the ! space that Syntax allows, as it gives us an unambiguous way to add to flags to values without worrying about syntax collisions; this would look something like This received general approval, but there was a split in how it should be interpreted. The broadly accepted possibilities were:
Rossen didn't want to discard (3), but Florian and I didn't like it, because it would mean a significant behavior change in forced-colors-mode that is likely to not really be tested. Also, given #4175 (comment), forced colors mode can't be just literally applying rules in a high origin based on a MQ. It's gonna have to do something magical for at least some properties, to preserve the alpha component of the author's cascade-winning color, so it doesn't feel like there's much value in preserving the fiction that it's just a line in the UA sheet; instead I think we should go whole-hog in the "it's a magical adjustment" direction. |
@emilio @FremyCompany @melanierichards please take a look at the above and weigh in |
OK, building on Tab's three options for interpreting a
In all of these cases, if you do use the media query, you'd probably need a big long line of In contrast, the way the original Maybe a media query that is activated by forced colors mode could implicitly get the Edit: This reads as if I'm all for Tab's option (2). I want to clarify that I think it's the best of those 3 options, but I'm still not fully convinced that a |
I don't like the proposal. Wrt #1, “overriding the UA-important origin that the forced-colors“, that's not actually how the mechanism works, because we resolved in #4020 to rewrite the author rules instead. Wrt all of them, they violate the principle that the UA !important rules always win. Always. And user !important rules override author rules. Always. Author rules should not be moving outside their cascade origin. |
I'm confused why you're implying this is true for "all of them" - one of the solutions is just "normal cascade, and if the cascade-winner has !foo, it doesn't get overridden by forced-colors". The other ones do talk about a new higher origin, but I assume it's still meant to be an author-level origin, and thus will get overridden by UA and user !important things. |
Not sure if this will come up in today's discussion on custom origins, but in case it does, here are my thoughts on this. BackgroundForced colors mode mostly does two things:
I am only aware of two ways one would want to adjust the forced-colors mode:
Thoughts on proposalsWhile custom origins and !overrides would definitely enable to solve the second use case, I think they give more power than is actually required to solve the problem at hand here (including unfortunate footguns). Aiming for more simplicity, I rather propose to add a third value to Option 1: I believe this should cover the case presented above in this discussion without modification to cascade rules whatsoever. Option 2: To avoid being painful, forms and replaced elements would have This second proposal is more strict than the first one, but slightly more powerful in some cases if we don't restrict Are there known use cases that wouldn't be solved by either proposal? (If not, my recommendation is to add this third value, and not fiddle with cascade rules in this scenario) |
Option 1 addendum: The proposed change here would be that, in forced-colors mode, if the fallback color of the With this addition, developers don't need to write this: .disabled-button {
color: rgb(128 128 128);
}
@media(forced-colors: active) {
.disabled-button {
border-color: GrayText;
forced-color-adjust: out-of-palette-only;
}
} They could write this instead: (and abstract this in a custom property variable if frequent) .disabled-button {
color: color(rgb 128 128 128, GrayText);
forced-color-adjust: out-of-palette-only;
} |
Okay, so on review, @fantasai and I like the "out of palette only" suggestion the best here. It seems to hit the use-case well while still respecting forced colors as much as possible. In fact, we think this should be the "auto" behavior; if we do still want the original auto behavior (do we?) we can add this as a stricter keyword. François' idea about auto-triggering color() fallback to a system color if possible is also pretty good, we think. Essentially, in forced-color mode we pretend that all the colorspaces aren't loaded, except for one capable of expressing the dozen-ish system colors. |
The CSS Working Group just discussed The full IRC log of that discussion<dael> Topic: [css-color-adjust-1] more granular overriding of forced colors mode than per-element<argyle> let's get this party started! woooooooOOOOOOOOOO <dael> github: https://github.com//issues/4178 <dael> TabAtkins: Had a bunch of discussions. In certain cases authors might want to override forced colors. Hopefully for useful purposes such as when forced colors removes nec/ distinctions. <dael> TabAtkins: Lots of discussion in thread and talk on F2F. <dael> TabAtkins: fremy came up with an idea I and fantasai like. If people use system colors already just don't adjust them. <dael> TabAtkins: If people use own random brand colors we overwrite. If system colors used don't override even if forced color would use different system colors. <dael> TabAtkins: That way people can work in palette of system color but direct how it looks when precision is necessary <dael> TabAtkins: Color function also has a fallback mech if your color space is not loaded or out of gamut. <dael> TabAtkins: Should consider all color spaces unloaded in forced colors. This let syou in non forced colors paint but auto say what fallback should be to system so you dn't have to design with system colors from the get go, but rely on them when necessary <florian> I like it. Well done fremy. <dael> TabAtkins: When doing forced color leave system colors as is regardless of system color. I think that solves it without all the complication in past <dael> Rossen_: If I have a selector that's intending to change color of border-left to non-system and forced color MQ matches how would that work? @media forced-colors and match prefers-color-scheme:dark so I want to give left-border my dark blue color. how would it work? <dael> TabAtkins: It would not. <dael> Rossen_: That's the pirmary use case. That's why we went down !override path. If people are using system colors that's a no opt. If I said canvas fine. I can fix from a system but not my own. <dael> TabAtkins: It's not a no op because you can choose a color that's not forced color. You can invoke marked color for example. But you can't choose arbitrary color <dael> Rossen_: I think that's main motivational case <dael> TabAtkins: It wasn't clear in thread arbitrary color was required. In that case let's shelve this because hte suggestion is not possible. <fantasai> That was not in any of the examples that melanierichards raised <dael> Rossen_: Sorry it wasn't clear in thread, example could be clearer. Fine to move on. Thank you for introducing it. <dael> astearns: Let's make sure that example is encoded in a recent comment. We'll likely come back |
Perhaps the motivational test case mislead the direction of this issue a bit. The main use case for the capability is intended to allow authors to supply arbitrary color values for a specific property override. Consider the following use case where the author's intent is to change the text color to dark gray in the case of
Per our previous discussions my understanding was that our intent is to enable this by adding the
|
I suppose my question now is: why is this different from the example in the OP? What is the justification for using colors other than what the user explicitly indicated they want to exclusively see? Note in particular that In particular, there is no guarantee in your example that I'd like to see some examples that need a specific color and couldn't be served by a system color. |
@tabatkins I combed through the list of bugs reported in Microsoft Edge that are related to this issue, and the majority could be resolved by the most recent proposal (ie. don't override system color in forced colors mode). There were a few example sites that I came across that would require specific colors other than system colors.
Although these examples would require non-system colors to maintain usability, I could easily see applying |
As resolved by the CSSWG [1], we should respect system color rules set by the author/user in Forced Colors Mode. This CL adds the logic to accomplish this. [1] w3c/csswg-drafts#4178 Bug: 970285 Change-Id: I9eb4a33f8767f48d0c0a6fd65faec15f11edc140
As resolved by the CSSWG [1], we should respect system color rules set by the author/user in Forced Colors Mode. This CL is the first of several changes to make this happen. Currently, in order to force colors in Forced Colors Mode, we revert the related properties at the author origin. This logic is now removed from the spec [2]. To accommodate the above changes, the plan is to simulate a revert at the end of the cascade, but only if the computed value for a given property is not already a system color and forced-color-adjust is set to auto. This CL moves the forced background-color logic from StyleAdjuster to StyleCascade to allow for easy access to the forced color rules (as defined in forced_colors.css). Since we are moving the adjustment of background-color to StyleCascade, we no longer need the -internal-forced-background-color-rgb property. As such, this CL also removes the code that was added to support this internal property [3]. [1] w3c/csswg-drafts#4178 [2] w3c/csswg-drafts@7c154dd [3] https://chromium-review.googlesource.com/c/chromium/src/+/2189974 Bug: 970285 Change-Id: Ic91a009a380820b41b355770acbe4de57c0787ff Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2376666 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Rune Lillesveen <futhark@chromium.org> Commit-Queue: Alison Maher <almaher@microsoft.com> Cr-Commit-Position: refs/heads/master@{#804585}
As resolved by the CSSWG [1], we should respect system color rules set by the author/user in Forced Colors Mode. This CL is the first of several changes to make this happen. Currently, in order to force colors in Forced Colors Mode, we revert the related properties at the author origin. This logic is now removed from the spec [2]. To accommodate the above changes, the plan is to simulate a revert at the end of the cascade, but only if the computed value for a given property is not already a system color and forced-color-adjust is set to auto. This CL moves the forced background-color logic from StyleAdjuster to StyleCascade to allow for easy access to the forced color rules (as defined in forced_colors.css). Since we are moving the adjustment of background-color to StyleCascade, we no longer need the -internal-forced-background-color-rgb property. As such, this CL also removes the code that was added to support this internal property [3]. [1] w3c/csswg-drafts#4178 [2] w3c/csswg-drafts@7c154dd [3] https://chromium-review.googlesource.com/c/chromium/src/+/2189974 Bug: 970285 Change-Id: Ic91a009a380820b41b355770acbe4de57c0787ff Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2376666 Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Rune Lillesveen <futhark@chromium.org> Commit-Queue: Alison Maher <almaher@microsoft.com> Cr-Commit-Position: refs/heads/master@{#804585}
As resolved by the CSSWG [1], we should respect system color rules set by the author/user in Forced Colors Mode. This CL is the second of several changes to make this happen. Currently, in order to force colors in Forced Colors Mode, we revert the related properties at the author origin. This logic is now removed from the spec [2]. To accommodate the above changes, the plan is to simulate a revert at the end of the cascade, but only if the computed value for a given property is not already a system color and forced-color-adjust is set to auto. This CL moves the logic for reverting properties that are affected by Forced Colors Mode to the end of the cascade using the ForceColors() method (which was added here [3]). [1] w3c/csswg-drafts#4178 [2] w3c/csswg-drafts@7c154dd [3] https://chromium-review.googlesource.com/c/chromium/src/+/2376666 Bug: 970285 Change-Id: I5039fdaf5ce6d5917a258e593fb2f527581c72e1
As resolved by the CSSWG [1], we should respect system color rules set by the author/user in Forced Colors Mode. This CL adds the logic to accomplish this. [1] w3c/csswg-drafts#4178 Bug: 970285 Change-Id: I9eb4a33f8767f48d0c0a6fd65faec15f11edc140
As resolved by the CSSWG [1], we should respect system color rules set by the author/user in Forced Colors Mode. This CL adds the logic to accomplish this. [1] w3c/csswg-drafts#4178 Bug: 970285 Change-Id: I9eb4a33f8767f48d0c0a6fd65faec15f11edc140
As resolved by the CSSWG [1], we should respect system color rules set by the author/user in Forced Colors Mode. This CL is the second of several changes to make this happen. Currently, in order to force colors in Forced Colors Mode, we revert the related properties at the author origin. This logic is now removed from the spec [2]. To accommodate the above changes, the plan is to simulate a revert at the end of the cascade, but only if the computed value for a given property is not already a system color and forced-color-adjust is set to auto. This CL moves the logic for reverting properties that are affected by Forced Colors Mode to the end of the cascade using the ForceColors() method (which was added here [3]). [1] w3c/csswg-drafts#4178 [2] w3c/csswg-drafts@7c154dd [3] https://chromium-review.googlesource.com/c/chromium/src/+/2376666 Bug: 970285 Change-Id: I5039fdaf5ce6d5917a258e593fb2f527581c72e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2388991 Commit-Queue: Alison Maher <almaher@microsoft.com> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/master@{#804985}
As resolved by the CSSWG [1], we should respect system color rules set by the author/user in Forced Colors Mode. This CL is the second of several changes to make this happen. Currently, in order to force colors in Forced Colors Mode, we revert the related properties at the author origin. This logic is now removed from the spec [2]. To accommodate the above changes, the plan is to simulate a revert at the end of the cascade, but only if the computed value for a given property is not already a system color and forced-color-adjust is set to auto. This CL moves the logic for reverting properties that are affected by Forced Colors Mode to the end of the cascade using the ForceColors() method (which was added here [3]). [1] w3c/csswg-drafts#4178 [2] w3c/csswg-drafts@7c154dd [3] https://chromium-review.googlesource.com/c/chromium/src/+/2376666 Bug: 970285 Change-Id: I5039fdaf5ce6d5917a258e593fb2f527581c72e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2388991 Commit-Queue: Alison Maher <almaher@microsoft.com> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/master@{#804985}
As resolved by the CSSWG [1], we should respect system color rules set by the author/user in Forced Colors Mode. This CL is the second of several changes to make this happen. Currently, in order to force colors in Forced Colors Mode, we revert the related properties at the author origin. This logic is now removed from the spec [2]. To accommodate the above changes, the plan is to simulate a revert at the end of the cascade, but only if the computed value for a given property is not already a system color and forced-color-adjust is set to auto. This CL moves the logic for reverting properties that are affected by Forced Colors Mode to the end of the cascade using the ForceColors() method (which was added here [3]). [1] w3c/csswg-drafts#4178 [2] w3c/csswg-drafts@7c154dd [3] https://chromium-review.googlesource.com/c/chromium/src/+/2376666 Bug: 970285 Change-Id: I5039fdaf5ce6d5917a258e593fb2f527581c72e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2388991 Commit-Queue: Alison Maher <almaher@microsoft.com> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/master@{#804985}
As resolved by the CSSWG [1], we should respect system color rules set by the author/user in Forced Colors Mode. This CL adds the logic to accomplish this. [1] w3c/csswg-drafts#4178 Bug: 970285 Change-Id: I9eb4a33f8767f48d0c0a6fd65faec15f11edc140
As resolved by the CSSWG [1], we should respect system color rules set by the author/user in Forced Colors Mode. This CL adds the logic to accomplish this. [1] w3c/csswg-drafts#4178 Bug: 970285 Change-Id: I9eb4a33f8767f48d0c0a6fd65faec15f11edc140
As resolved by the CSSWG [1], we should respect system color rules set by the author/user in Forced Colors Mode. This CL adds the logic to accomplish this. [1] w3c/csswg-drafts#4178 Bug: 970285 Change-Id: I9eb4a33f8767f48d0c0a6fd65faec15f11edc140 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390865 Commit-Queue: Alison Maher <almaher@microsoft.com> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/master@{#805469}
As resolved by the CSSWG [1], we should respect system color rules set by the author/user in Forced Colors Mode. This CL adds the logic to accomplish this. [1] w3c/csswg-drafts#4178 Bug: 970285 Change-Id: I9eb4a33f8767f48d0c0a6fd65faec15f11edc140 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390865 Commit-Queue: Alison Maher <almaher@microsoft.com> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/master@{#805469}
As resolved by the CSSWG [1], we should respect system color rules set by the author/user in Forced Colors Mode. This CL adds the logic to accomplish this. [1] w3c/csswg-drafts#4178 Bug: 970285 Change-Id: I9eb4a33f8767f48d0c0a6fd65faec15f11edc140 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390865 Commit-Queue: Alison Maher <almaher@microsoft.com> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/master@{#805469}
Pushed a revision of your edits, @tabatkins. There remain some interesting questions:
|
The CSS Working Group just discussed
The full IRC log of that discussion<emilio> topic: [css-color-adjust-1] more granular overriding of forced colors mode than per-element<astearns> particularly https://github.com//issues/4178#issuecomment-700481333 <fantasai> github: https://github.com//issues/4178#issuecomment-700481333 <emilio> fantasai: I had a few follow-up questions, one of them we just resolved on <emilio> ... we said that reverted colors should try to match the user stylesheet <emilio> ... I added that as a SHOULD <emilio> ... This would override explicit UA/User values, is that what we want? <fantasai> https://github.com/w3c/csswg-drafts/commit/588ce6183bc25e62b61ec723f700b2c356d8a89a#diff-8974d243f99b24bfbefbf89dee6dc5d4a06890610cb205535e0d8d279db1d587 <emilio> TabAtkins: third bullet point in ^ is the relevant one <emilio> ... before we had no details other than it should be an "appropriate" system color <emilio> fremy: yeah I assume it'd be the one in the UA sheet by default <emilio> ... as an author you can override it using system colors <emilio> TabAtkins: are we looking for a resolution or just review? <emilio> fantasai: Yeah I wanted to check those requirements and whether SHOULD is appropriate <emilio> RESOLVED: Republish WD with the edits <emilio> fantasai: we don't have that many issues left in color-adjust <emilio> ... I think the other major issue is `only` |
Somewhat combinatorial between specs, but css-color-adjust-1, Forced Color Schemes might be the best place to put this.
It would be ideal if an author could override a property value affected by forced colors without requiring the author to set
forced-color-adjust
tonone
on the element.In some cases, authors will want to fully manage how an element is styled in forced color modes, which is an appropriate use of
forced-color-adjust
. But in other cases, they may just want to change a singular property value without interfering with other UA forced color styles, e.g.:We should perhaps tweak cascade expectation in Forced Color Schemes such that cascaded values outside of the
forced-colors
media query are unset, but origin override rules apply when additional styles are set within aforced-colors
media query block. Essentially want to ensure that point 4 of the Cascade Order in the initial High Contrast explainer is true in standard implementations of forced color modes.The text was updated successfully, but these errors were encountered: