You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-pseudo] Highlight pseudos and forced-color-adjust #7264
I'd like to try to clarify how forced-color-adjust should apply to highlight pseudos.
In crbug.com/1309835, @andruud raised the question of how forced-color-adjust:preserve-parent-color should interact with the special definition of currentColor used with highlight inheritance. Normally preserve-parent-color has currentColor compute to the used value of the parent's color, but with highlights it's not so clear what this value should resolve to. Making it dependent on which highlight overlays are active could be problematic as that info may not be readily available until paint-time.
A simple way to resolve any strangeness could be to just treat forced-color-adjust:preserve-parent-color as forced-color-adjust:none for highlights. The motivating use case for preserve-parent-color involving SVG icons doesn't seem to be applicable to highlight pseudos as far as I can tell.
Considering things more broadly, does it make sense to allow forced-color-adjust in highlight pseudos at all? It is not one of the properties listed at https://drafts.csswg.org/css-pseudo-4/#highlight-styling, but Chrome allows it to be used with ::selection and the other highlight pseudos when --enable-blink-features=HighlightInheritance is enabled. Example here. (When HighlightInheritance is not enabled, Chrome looks like it always ignores forced colors for ::selection pseudos, which seems clearly wrong).
Perhaps highlights should always just use the forced-colors state of the originating element. Does it actually make sense to allow authors to opt out of forced colors for highlights but not the element containing the underlying text? Or vice versa?
The CSS Working Group just discussed [css-pseudo] Highlight pseudos and forced-color-adjust, and agreed to the following:
RESOLVED: forced-color-adjust doesn't do anything on highlight pseudos, and highlight pseudos take their forced color state from the originating element
The full IRC log of that discussion
<dbaron> Topic: [css-pseudo] Highlight pseudos and forced-color-adjust
<emilio> (I guess that's what chrishtr just said)
<dbaron> github: https://github.com//issues/7264
<dbaron> dandclark: question about how forced-color-adjust:preserve-parent-color should work with highlight inheritance
<dbaron> dandclark: this interaction is potentially problematic.
<fantasai> emilio, yeah, and it's obnoxious when I try to load a page and it gives me a blank forever even though I know the text is loaded
<dbaron> dandclark: Prereq: consider wether forced-color-adjust should be allowed in highlight pseudos.
<dbaron> dandclark: List of properties. Currently not allowed there.
<Rossen_> q?
<dbaron> s/Prereq/Prerequisite/
<dbaron> s/List/The spec gives a list/
<dbaron> s/wether/whether/
<dbaron> fantasai: I think the idea of having it not apply and just applying the forced-color-adjust effect of the originating element makes sense to me.
<dbaron> fantasai: I think that was mentioned in the post as a way to deal with this.
<dbaron> dandclark: I think that's a good outcome... seems simplest.
<dbaron> dandclark: For all other color based properties the highlights are sort of an independent cascade. But I think it makes sense here. Seems odd that the originating element would take forced colors and the highlights not.
<dbaron> dandclark: If the originating element has forced-color-adjust:preserve-parent-color, what does that mean for highlight pseudos that are active over that originating element?
<dbaron> fantasai: Effect is that the color property is able to inherit from the parent the actual color of the parent... and that doesn't really impact the highlight pseudos ... which doesn't matter for highlight pseudos where the currentcolor keyword comes from the previous layer. So the keyword wouldn't have an effect.
<dbaron> dandclark: so then try to resolve that forced-color-adjust doesn't do anything on highlight pseudos, and that highlight pseudos take forced color state of originating element
<dbaron> Rossen: Proposed resolution: forced-color-adjust doesn't do anything on highlight pseudos, and highlight pseudos take their forced color state from the originating element
<dbaron> RESOLVED: forced-color-adjust doesn't do anything on highlight pseudos, and highlight pseudos take their forced color state from the originating element
@fantasai Could you help me understand what these tags mean?
I'm guessing that Needs Edits means that a spec change is needed to reflect the meeting resolution, but I'm not sure about Closed Accepted by CSSWG Resolution.
Sorry if these are documented somewhere; I looked but couldn't find anything.
@dandclark The Needs Edits label, as you guessed, means that the spec needs edits to reflect the resolution; Closed Accepted by CSSWG Resolution means that the issue was resolved by a CSSWG decision. There's other Closed labels that reflect whether it was accepted or rejected, and what type of acceptance... these are currently only documented in https://github.com/w3c/csswg-drafts/blob/main/bin/issuegen.pl#L104 and I mainly use it as a forcing function to think about what kind of decision or review might be needed.
The resolution is now edit in as 05e463d ; please let me know if that reflects your understanding of the resolution of this issue! Thanks!
Activity
delan commentedon May 10, 2022
(ping @fantasai, @frivoal)
css-meeting-bot commentedon May 18, 2022
The CSS Working Group just discussed
[css-pseudo] Highlight pseudos and forced-color-adjust, and agreed to the following:RESOLVED: forced-color-adjust doesn't do anything on highlight pseudos, and highlight pseudos take their forced color state from the originating elementThe full IRC log of that discussion
<dbaron> Topic: [css-pseudo] Highlight pseudos and forced-color-adjust<emilio> (I guess that's what chrishtr just said)
<dbaron> github: https://github.com//issues/7264
<dbaron> dandclark: question about how forced-color-adjust:preserve-parent-color should work with highlight inheritance
<dbaron> dandclark: this interaction is potentially problematic.
<fantasai> emilio, yeah, and it's obnoxious when I try to load a page and it gives me a blank forever even though I know the text is loaded
<dbaron> dandclark: Prereq: consider wether forced-color-adjust should be allowed in highlight pseudos.
<dbaron> dandclark: List of properties. Currently not allowed there.
<Rossen_> q?
<dbaron> s/Prereq/Prerequisite/
<dbaron> s/List/The spec gives a list/
<dbaron> s/wether/whether/
<dbaron> fantasai: I think the idea of having it not apply and just applying the forced-color-adjust effect of the originating element makes sense to me.
<dbaron> fantasai: I think that was mentioned in the post as a way to deal with this.
<dbaron> dandclark: I think that's a good outcome... seems simplest.
<dbaron> dandclark: For all other color based properties the highlights are sort of an independent cascade. But I think it makes sense here. Seems odd that the originating element would take forced colors and the highlights not.
<dbaron> dandclark: If the originating element has forced-color-adjust:preserve-parent-color, what does that mean for highlight pseudos that are active over that originating element?
<dbaron> fantasai: Effect is that the color property is able to inherit from the parent the actual color of the parent... and that doesn't really impact the highlight pseudos ... which doesn't matter for highlight pseudos where the currentcolor keyword comes from the previous layer. So the keyword wouldn't have an effect.
<dbaron> dandclark: so then try to resolve that forced-color-adjust doesn't do anything on highlight pseudos, and that highlight pseudos take forced color state of originating element
<dbaron> Rossen: Proposed resolution: forced-color-adjust doesn't do anything on highlight pseudos, and highlight pseudos take their forced color state from the originating element
<dbaron> RESOLVED: forced-color-adjust doesn't do anything on highlight pseudos, and highlight pseudos take their forced color state from the originating element
See official minutes
dandclark commentedon May 18, 2022
@fantasai Could you help me understand what these tags mean?
I'm guessing that
Needs Editsmeans that a spec change is needed to reflect the meeting resolution, but I'm not sure aboutClosed Accepted by CSSWG Resolution.Sorry if these are documented somewhere; I looked but couldn't find anything.
Highlight pseudos use the forced-color status of their originating el…
Highlight pseudos use the forced-color status of their originating el…
Highlight pseudos use the forced-color status of their originating el…
Highlight pseudos use the forced-color status of their originating el…
Highlight pseudos use the forced-color status of their originating el…
4 remaining items
fantasai commentedon Dec 29, 2022
@dandclark The Needs Edits label, as you guessed, means that the spec needs edits to reflect the resolution; Closed Accepted by CSSWG Resolution means that the issue was resolved by a CSSWG decision. There's other Closed labels that reflect whether it was accepted or rejected, and what type of acceptance... these are currently only documented in https://github.com/w3c/csswg-drafts/blob/main/bin/issuegen.pl#L104 and I mainly use it as a forcing function to think about what kind of decision or review might be needed.
The resolution is now edit in as 05e463d ; please let me know if that reflects your understanding of the resolution of this issue! Thanks!
dandclark commentedon Jan 5, 2023
Thanks for clarifying! 05e463d looks right to me, so I'll go ahead and fully Close this.
[css-pseudo-4] Define forced colors mode on highlight pseudo-elements. …
Update test: forced-color-adjust does not apply to pseudo-highlights
Update test: forced-color-adjust does not apply to pseudo-highlights
Update test: forced-color-adjust does not apply to pseudo-highlights
Update test: forced-color-adjust does not apply to pseudo-highlights
Update test: forced-color-adjust does not apply to pseudo-highlights
Update test: forced-color-adjust does not apply to pseudo-highlights
Bug 1844703 [wpt PR 41140] - Update test: forced-color-adjust does no…
Update test: forced-color-adjust does not apply to pseudo-highlights
Bug 1771389 [wpt PR 34223] - Highlight pseudos use the forced-color s…
Bug 1844703 [wpt PR 41140] - Update test: forced-color-adjust does no…