Re: [csswg-drafts] [css-pseudo] Allow custom Properties in ::selection pseudos (revisited) (#11317)

The CSS Working Group just discussed `[css-pseudo] Allow custom Properties in ::selection pseudos (revisited)`, and agreed to the following:

* `RESOLVED: allow custom properties on highlight pseudos`
* `RESOLVED: Allow custom properties on highlight pseudoes; custom properties continue to inherit from the originating element`

<details><summary>The full IRC log of that discussion</summary>
&lt;kbabbitt> schenney: on our 3rd attempt for highlight inheritance in chrome<br>
&lt;kbabbitt> ... TabAtkins and lea pointed out that we want custom props on highlights<br>
&lt;kbabbitt> ... previous resoution was no custom props on highlights, inherit from originating element<br>
&lt;kbabbitt> ... think it's a no brainer we should allow custom props on pseudo highlights<br>
&lt;kbabbitt> ... then there's a question of how we inherit<br>
&lt;kbabbitt> ... 2 possibilities<br>
&lt;kbabbitt> fantasai: let's do in one go<br>
&lt;kbabbitt> schenney: the simplest way to implement is to use existing model for inheritance<br>
&lt;kbabbitt> ... in highlight pseudoes<br>
&lt;kbabbitt> ... inherit through originating element chain<br>
&lt;kbabbitt> ... look first on highlight then on originating element<br>
&lt;kbabbitt> ... which inherits through remaining element cain<br>
&lt;kbabbitt> ... inherit custom properties for highlights through originating element chain<br>
&lt;kbabbitt> fantasai: but not regular propertes<br>
&lt;kbabbitt> schenney: yes<br>
&lt;kbabbitt> ... simple to implement, matches previous behavior<br>
&lt;kbabbitt> ...downside is that custom props have diff inheritance model from every other property allowed on highlights<br>
&lt;kbabbitt> ... alternative method allows inherit both through highlight chain and originating chain<br>
&lt;kbabbitt> ... inherit from highlight chain, and on top of that from originating element<br>
&lt;kbabbitt> ... and then any properties on highlight itself<br>
&lt;kbabbitt> .. downside is hard to state, pain to debug<br>
&lt;kbabbitt> ... not all browser can implement efficiently]<br>
&lt;kbabbitt> ... upside is that it allows authors to put custom props on highlight without knowing they're special<br>
&lt;kbabbitt> ... whereas inherit from origin requires additional explanation<br>
&lt;kbabbitt> ... from that perspective I like the fact we can transition to both methods existing at same time<br>
&lt;kbabbitt> ... but ack that it's messy<br>
&lt;kbabbitt> ... should we go for simplicity but annoyance to developers vs complexity with both methods<br>
&lt;TabAtkins> q+<br>
&lt;astearns> ack fantasai<br>
&lt;kbabbitt> fantasai: say I set color: customcolor<br>
&lt;kbabbitt> ... and then customcolor is set to blue ... on a highlight pseudo<br>
&lt;fantasai> span::selection { color: var(--customcolor); }<br>
&lt;fantasai> p::selection { --customcolor: blue; }<br>
&lt;fantasai> span { --customcolor: red; }<br>
&lt;kbabbitt> fantasai: now the question is what color is the selection/<br>
&lt;kbabbitt> ... from author perspective both red and blue are reasonable<br>
&lt;kbabbitt> ... we've set custom-color close to where we're using it<br>
&lt;kbabbitt> ... we've also set it differently on selection element<br>
&lt;kbabbitt> ... you're proposing a priority between these two, will that make sense to everyone?<br>
&lt;kbabbitt> ... even when there's an ancestor in between?<br>
&lt;kbabbitt> schenney: yes. so...<br>
&lt;kbabbitt> ... people who have been working before the originating element will have priority<br>
&lt;kbabbitt> ... people coiming new, prent will have priority<br>
&lt;kbabbitt> ... agree each is equally valid<br>
&lt;kbabbitt> ... inherit from parent, then originating, then span, so color will be red<br>
&lt;kbabbitt> ... reason for this is it supports back compat use case<br>
&lt;kbabbitt> ... if there's any ambiguity<br>
&lt;kbabbitt> ... you've hit the footgun where it's unclear when we inherit from both<br>
&lt;kbabbitt> ... I'd expet people to use one or other<br>
&lt;fantasai> p::selection { --customcolor: blue; }<br>
&lt;kizu> q+<br>
&lt;kbabbitt> ... if they use both, colors should match up<br>
&lt;fantasai> p { --customcolor: red; }<br>
&lt;kbabbitt> fantasai: in first example [in irc] you'd get red?<br>
&lt;dbaron> (It seems a bit weird if --customcolor inherits differently from color.)<br>
&lt;kbabbitt> schenney: yes<br>
&lt;kbabbitt> fantasai: second example also red?<br>
&lt;kbabbitt> schenney: no blue\<br>
&lt;kbabbitt> [crosstalk]<br>
&lt;kbabbitt> fantasai: no dispute that text not inside span is blue<br>
&lt;kbabbitt> ... part inside span is red or blue?<br>
&lt;kbabbitt> .. because span's value for custom color is read<br>
&lt;kbabbitt> schenney: yes<br>
&lt;kbabbitt> ... it would be read<br>
&lt;kbabbitt> s/read/red/<br>
&lt;kbabbitt> ... originating will override inheritance<br>
&lt;kbabbitt> ... from a back compat perspective we want to inherit from originating element chain and be done<br>
&lt;kbabbitt> ... these questions don't arise which is good<br>
&lt;kbabbitt> ... we'd have to give advice to authors<br>
&lt;kbabbitt> ... custom properties in highlight are distinct from other custom props<br>
&lt;kbabbitt> ... pseudos need to have same values as elements<br>
&lt;kbabbitt> ... andruud is for just inherit through originating element chain<br>
&lt;kbabbitt> ...because it avoids complexity<br>
&lt;kbabbitt> ... which is why I implemented it that way in Chromium<br>
&lt;florian> q+<br>
&lt;kbabbitt> ... purely the feature I'm thinking about<br>
&lt;astearns> ack TabAtkins<br>
&lt;kbabbitt> TabAtkins: with andruud on just use originating element<br>
&lt;florian> q-<br>
&lt;kbabbitt> ... zipper concept you're describing is not possible under current def of inheritance<br>
&lt;kbabbitt> ... a prop always has an inherited value from a particular spot<br>
&lt;kbabbitt> ... we'd have to invent a new concept which is possible<br>
&lt;kbabbitt> ... but sticking with current model is favorable if it can be avoided<br>
&lt;astearns> ack kizu<br>
&lt;kbabbitt> kizu: don't think it will matter in practice<br>
&lt;kbabbitt> ...maybe author will expect things to behave the same<br>
&lt;kbabbitt> ... the way you inhert through highlight elements makes sense since you don't want color to match backgruond<br>
&lt;kbabbitt> ... but I don't think this will matter in practice<br>
&lt;kbabbitt> ... what will be simpler should be okay<br>
&lt;kbabbitt> ... not a point of confusion because not a common use case<br>
&lt;astearns> ack fantasai<br>
&lt;kbabbitt> fantasai: it could make sense to allow a custom prop to be set on highlight and then use directly on same highlight pseudo<br>
&lt;kbabbitt> ... but this double inheritance is weird and will cause problems<br>
&lt;kbabbitt> ... won't match what people expet<br>
&lt;kbabbitt> schenney: that's option 1<br>
&lt;kbabbitt> ...only resolution needed there is allow custom props on highlight pseudos<br>
&lt;kbabbitt> ... which I'm totally fine wityh<br>
&lt;kbabbitt> Proposed: allow custom properties on highlight pseudos<br>
&lt;kbabbitt> RESOLVED: allow custom properties on highlight pseudos<br>
&lt;fantasai> PROPOSED: Allow custom properties on highlight pseudoes; custom properties continue to inherit from the originating element<br>
&lt;fantasai> RESOLVED: Allow custom properties on highlight pseudoes; custom properties continue to inherit from the originating element<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11317#issuecomment-2622922904 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 29 January 2025 21:43:49 UTC