Re: [csswg-drafts] [css-pseudo] highlights and color:currentColor (#6818)

The CSS Working Group just discussed `highlights and color:currentcolor`.

<details><summary>The full IRC log of that discussion</summary>
&lt;emilio> topic: highlights and color:currentcolor<br>
&lt;emilio> github: https://github.com/w3c/csswg-drafts/issues/6818<br>
&lt;emilio> delan: setting color to currentcolor is always a special-case, it normally means the same thing as `inherit` but for highlights we have a new meaning where according to the spec it means "the next highlight layered below"<br>
&lt;emilio> ... there's two questions about it, first one is, when we say the next below, are we considering just the highlights that highlight that piece of text?<br>
&lt;emilio> ... so for example if you have `::target-text { color: red } ::selection { color: currentcolor }`, should it always be red? Or only if the selected text is also `::target-text`<br>
&lt;emilio> fantasai: only reasonable behavior is the later<br>
&lt;emilio> delan: agreed, it's mostly ok impl-wise except for e.g. getComputedStyle<br>
&lt;emilio> ... if you ask for the `getComputedStyle(element, "::selection").color`, then what is the color? It could be many different things depending on what you're looking at<br>
&lt;emilio> astearns: maybe return just the keyword in this particular case?<br>
&lt;emilio> delan: gCS is explicitly using the resolved value<br>
&lt;emilio> ... which turns it into an actual color<br>
&lt;emilio> florian: do we have precedent for this kind of problem?<br>
&lt;fantasai> s/things/colors/<br>
&lt;emilio> delan: not aware of it<br>
&lt;emilio> florian: we might have a similar problem with fragmentation if you allow different fragments to be styled differently<br>
&lt;emilio> ... I believe we have answered that except exceptions we'd answer the first one<br>
&lt;emilio> ... I think that means that if the entire selection crosses the entire element then that makes sense but then you look at the first chunk of the element and answer based on that one<br>
&lt;emilio> q+<br>
&lt;emilio> delan: so answering based on the first highlight for the first element or so?<br>
&lt;emilio> florian: that seems similar to other questions on the past<br>
&lt;fantasai> emilio: Right now, getComptuedStyle() with selection does return the actual selection colors, regardless of whether anything is selected<br>
&lt;fantasai> emilio: would be bad if it involved resolving style of all the layers below<br>
&lt;sanketj> q+<br>
&lt;fantasai> emilio: also, color: initial and color: currentColor do different things here, is weird<br>
&lt;astearns> ack emilio<br>
&lt;fantasai> emilio: I'm not sure I agree with behavior of currentColor here, would be nice if not so weirdly<br>
&lt;fantasai> emilio: Do we know reason for currentColor being different here?<br>
&lt;fantasai> delan: my understanding, the intuitive intent of 'color: currentColor' is same for highlights and not-highlights<br>
&lt;fantasai> delan: it means don't change the color<br>
&lt;fantasai> delan: But in case of highlight, have a different inheritance tree, inheriting from parent's highlight styles<br>
&lt;fantasai> delan: so it means "don't change the color compared to if you didn't highlight with this highlight"<br>
&lt;fantasai> delan: if selection says currentColor, says use color I would use if text was not selected<br>
&lt;fantasai> delan: but that's not inherit, can't be<br>
&lt;fantasai> emilio: Maybe selection styles shouldn't ...<br>
&lt;fantasai> emilio: idk<br>
&lt;fantasai> emilio: seems very weird to specialcase currentcolor and bunch of other stuff that could be specialcased<br>
&lt;fantasai> delan: highlights are a lot of special cases. Maybe too many<br>
&lt;fantasai> emilio: adding all this complexity, we have a lot of use cases for this for this particular way<br>
&lt;fantasai> emilio: currentcolor behaves the same everywhere else<br>
&lt;fantasai> emilio: could argue the same for ::first-line and that kind of thing<br>
&lt;sanketj> q-<br>
&lt;fantasai> emilio: in fact, don't we solve this for ::first-line in some other interesting way?<br>
&lt;fantasai> emilio: If you have a span with 'color :currentcolor'<br>
&lt;emilio> `div { color: green } div::first-line { color: red } span { color: currentColor }` then `&lt;div>&lt;span>First line&lt;/span>&lt;/div>`<br>
&lt;fantasai> delan: is it not well-defined for these in the same way, they add boxes to the box tree<br>
&lt;fantasai> delan: there's a well-defined inheritance in the one tree?<br>
&lt;fantasai> delan: whereas there's a separate inheritance tree for each pseudo-element<br>
&lt;fantasai> florian: it is well-behaved in browsers, i.e. does the thing delan expects<br>
&lt;fantasai> emilio: making the span inherit from first line, can we make selection inherit from whatever special style we're taking the color from instead, and there's *an* answer for this?<br>
&lt;fantasai> astearns: we are out of time, so take this back to the issue<br>
&lt;fantasai> astearns: can come back to it next week along with the other pseudo issues... though we are going ot start with lenght units and video MQ<br>
&lt;fantasai> astearns: so thanks for putting all these issues up<br>
&lt;fantasai> astearns: can you join next week?<br>
&lt;fantasai> delan: yes<br>
&lt;oriol> ::first-line inheritance was discussed in https://github.com/w3c/csswg-drafts/issues/1097<br>
&lt;fantasai> astearns: out of time<br>
&lt;fantasai> astearns: so done for this week<br>
&lt;florian> "pick the first fragment" was discussed in https://github.com/w3c/csswg-drafts/issues/6513<br>
</details>


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


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

Received on Wednesday, 8 December 2021 18:02:44 UTC