[csswg-drafts] [css-pseudo] Highlight pseudos and forced-color-adjust (#7264)

dandclark has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-pseudo] Highlight pseudos and forced-color-adjust ==
I'd like to try to clarify how `forced-color-adjust` should apply to highlight pseudos.

In [crbug.com/1309835](https://crbug.com/1309835), @andruud raised the question of how `forced-color-adjust:preserve-parent-color` should interact with the special definition of [`currentColor`](https://drafts.csswg.org/css-pseudo-4/#highlight-text) used with [highlight inheritance](https://drafts.csswg.org/css-pseudo-4/#highlight-cascade). 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](https://github.com/w3c/csswg-drafts/issues/6310) 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](https://codepen.io/daniec/pen/eYVZywZ). (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?

cc @alisonmaher @delan @mrego 



Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7264 using your GitHub account


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

Received on Tuesday, 10 May 2022 00:07:43 UTC