Skip to content

[css-pseudo] color-scheme should be an allowed property for highlight pseudos #11011

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

Closed
BenjaminAster opened this issue Oct 8, 2024 · 6 comments

Comments

@BenjaminAster
Copy link

The fact that the color-scheme CSS property is not allowed on highlight pseudo-elements (e.g. ::selection) has the side effect that the light-dark() function effectively cannot be used to style highlight pseudos (it will always consider the "light" value). I think it would make sense to just add color-scheme to the list of allowed properties, which would make this possible.

@fantasai fantasai added css-pseudo-4 Current Work css-color-adjust-1 Current Work Agenda+ Async Resolution: Proposed Candidate for auto-resolve with stated time limit labels Oct 8, 2024
@fantasai
Copy link
Collaborator

fantasai commented Oct 8, 2024

This seems like an oversight.

@schenney-chromium
Copy link
Contributor

Yes, I agree. I see no problem implementing this in Chromium.

Async resolution is fine by me.

@astearns
Copy link
Member

The CSSWG will automatically accept this resolution one week from now if no objections are raised here. Anyone can add an emoji to this comment to express support. If you do not support this resolution, please add a new comment.

Proposed Resolution: Add color-scheme to the set of properties that work with highlight pseudo-elements

@astearns astearns added Async Resolution: Call For Consensus Resolution will be called after time limit expires and removed Agenda+ Async Resolution: Proposed Candidate for auto-resolve with stated time limit labels Oct 15, 2024
@fantasai
Copy link
Collaborator

fantasai commented Oct 15, 2024

OK, changed my mind. :) We actually have two lists of properties involved here after resolving #7591 so we need to confirm which one we should be adding it to: the list of applicable properties, or the list of properties we steal from the originating element in order to resolve the applicable properties.

Also, we should resolve forced-color-adjust in the same way.

Moving to the regular agenda.

@fantasai fantasai added Agenda+ and removed Async Resolution: Call For Consensus Resolution will be called after time limit expires labels Oct 15, 2024
@schenney-chromium
Copy link
Contributor

Thinking much more deeply about it ...

  • Layout affecting properties are not allowed on highlight pseudos, so such properties must be taken from the originating element when needed to resolve units .
  • Custom properties from originating elements support existing use cases and make the change in behavior possible at all.
  • Color modifying properties could go either way from a technical perspective. The do not affect layout so could go on the highlight itself, but it's hard to see why you would want the highlight and the originating element to differ in their color adjustment.

The key question then is whether there is a use case in which you want different forced-color-adjust and color-scheme for the underlying text and it's highlight. I'm having a hard time seeing the benefits and I can definitely see negative outcomes, such as contrast problems. It's also more work for authors if they need to duplicate their forced-color-adjust and color-scheme properties onto the highlights.

Does anyone have a use case for forced-color-adjust and color-scheme differing between a highlight pseudo and it's originating element?

@astearns astearns moved this to FTF agenda items in CSSWG January 2025 meeting Jan 22, 2025
@astearns astearns moved this from FTF agenda items to Regular agenda items in CSSWG January 2025 meeting Jan 22, 2025
@astearns astearns moved this from Regular agenda items to Wednesday morning in CSSWG January 2025 meeting Jan 27, 2025
@astearns astearns moved this from Wednesday morning to Wednesday afternoon in CSSWG January 2025 meeting Jan 29, 2025
@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-pseudo] `color-scheme` should be an allowed property for highlight pseudos, and agreed to the following:

  • RESOLVED: Add forced-color-adjust and color-scheme to set of properties that work with highlight pseudo, taking value from originating element
The full IRC log of that discussion <kbabbitt> fantasai: for highlight pseudos we have 2 wasy of applying properties
<kbabbitt> ...
<bramus> list of props: https://drafts.csswg.org/css-pseudo-4/#highlight-styling
<kbabbitt> ... props specified on highlight pseudo element eg. color, ...
<kbabbitt> ... and props we take from the originating element
<kbabbitt> ....e..g font properties
<kbabbitt> ... for this issue, we should decide are we taking this value directly off highlight pseudo?
<kbabbitt> ... in which case it inherits through pseudo's ancestry
<kbabbitt> ... or are we taking from originating element
<kbabbitt> ... for forced-color adjust and color scheme I think we want from originating element
<bramus> +1
<kbabbitt> ... then that will match unterlying element
<dbaron> +1
<kbabbitt> astearns: in my read of stephen's comment he would agree
<kbabbitt> schenney: yes I agree
<kbabbitt> fantasai: forced-color-adjust should behave same as color-scheme
<kbabbitt> Proposed: Add forced-color-adjust and color-scheme to set of properties that work with highlight pseudo, taking value from originating element
<kbabbitt> bramus: forced is already on that list
<lea> +1
<kbabbitt> astearns: objections?
<kbabbitt> bramus: color-scheme is already listed
<lea> I don't see why we may NOT want to allow these
<kbabbitt> RESOLVED: Add forced-color-adjust and color-scheme to set of properties that work with highlight pseudo, taking value from originating element

schenney-chromium added a commit to schenney-chromium/csswg-drafts that referenced this issue Feb 18, 2025
Issue w3c#11011 was resolved to take forced-colors and color-scheme from the originating element. Remove the note for the issue.
svgeesus pushed a commit that referenced this issue Feb 28, 2025
Issue #11011 was resolved to take forced-colors and color-scheme from the originating element. Remove the note for the issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Wednesday afternoon
Development

No branches or pull requests

5 participants