- From: Stephen Chenney via GitHub <sysbot+gh@w3.org>
- Date: Tue, 03 Dec 2024 16:37:03 +0000
- To: public-css-archive@w3.org
schenney-chromium has just created a new issue for https://github.com/w3c/csswg-drafts:
== [css-pseudo] Allow custom Properties in ::selection pseudos (revisited) ==
Chromium continues to try to ship the Highlight Inheritance model for selection. The third attempt has failed because CSS pre-processing and generation tools create `::selection` rules like this:
```html
div::selection {
   --my-opacity: 1;
   background-color: rgb(0 0 0/var(--my-opacity));
}
```
In https://github.com/w3c/csswg-drafts/issues/6264 we allowed custom properties on highlight pseudos.
Then in  https://github.com/w3c/csswg-drafts/issues/6641 we also said that all custom properties should be copied from the root for the `root::selection`, and then start adding those in the `::selection` inheritance path.
This proved insufficient when launched in Chromium because many sites rely on `::selection` inheriting custom properties from their originating elements. So we discussed disallowing custom properties in highlights and inheriting from the originating elements, and resolved to do that in https://github.com/w3c/csswg-drafts/issues/9909.
@tabatkins commented in https://github.com/w3c/csswg-drafts/issues/6641 that the example above must be allowed for their support. @LeaVerou also raised the same concern in one of the issues above. I did not pay enough attention to that. So the change from #9909 broke many many major sites.
To make it possible to ship highlight inheritance for `::selection`, and bring `::selection` implementations into line with other highlight pseudos, I believe we need this ...
*`::selection` pseudo elements inherit custom properties from their `originating-element` and then apply custom properties from the `::selection` rule itself. Custom properties from `::selection` rules apply only within that rule, and are not inherited by descendants.*
My current thinking is that we limit this behavior to `::selection` and not other highlight pseudos, as a back-compatibility requirement. It's not a strongly held position.
Proposing async resolution but feel free to add to the agenda. 4 week time limit given holidays.
@delan @fantasai @frivoal 
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11317 using your GitHub account
-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 3 December 2024 16:37:04 UTC