Re: [csswg-drafts] [css-pseudo-4] Ensuring selection foreground/background contrast (#6150)

I would like to get this issue resolved. My proposal is that UAs should respect the colors given in ::selection pseudos (including inherited) as statements of an author's intent, even if that intent hides text when selected. UAs can do anything they want with selection painting in the absence of ::selection.

It seems desirable to add "only when both color and background color are given in ::selection" but it's not clear to me that it is implementable across browsers and is probably unnecessarily complex. I'm open to discussion.

Looking at the various proposals/concerns raised in the previous discussion:
- This resolution ONLY applies when a ::selection pseudo is applied, in which case the have color and background color on the pseudo style inherited from some place that starts with good contrast, generally HighlightColor and HighlightBackground.
- Allowing UA tweaks is very hard to spec in a way that handles all cases, including transparency, contrast thresholds, compatible color adjustment algorithms etc.
- Allowing UA tweaks in the case of ::selection is essentially ignoring the authors intent, which was to style the selection. Unless we think that's a bad thing to allow (then why have ::selection?) I don't think we should try to second guess their design.

And as one data point, there is a WPT that explicitly tests for this behavior: css/css-pseudo/active-selection-018.html


-- 
GitHub Notification of comment by schenney-chromium
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6150#issuecomment-1806910260 using your GitHub account


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

Received on Saturday, 11 November 2023 20:29:36 UTC