CSS highlight pseudo ::search-text
WebKittens
@smfr @annevk
Title of the proposal
CSS Pseudo-Elements Module Level 4 § Highlight Pseudo-elements § Selecting Highlighted Content
URL to the spec
https://drafts.csswg.org/css-pseudo-4/#selectordef-search-text
URL to the spec's repository
https://github.com/w3c/csswg-drafts/tree/main/css-pseudo-4
Issue Tracker URL
No response
Explainer URL
https://github.com/Igalia/explainers/blob/main/css/find-in-page/README.md
TAG Design Review URL
N/A
Mozilla standards-positions issue URL
https://github.com/mozilla/standards-positions/issues/1103
WebKit Bugzilla URL
No response
Radar URL
No response
Description
This feature allows for CSS styling of the search results shown using a browser’s find-in-page feature.
The Chromium intent to prototype is here
This feature allows modifying a new highlight style for the matched "find-in-page" strings, which are rendered differently across browsers. @fantasai, could you give an opinion about this?
Safari's rendering of find-in-page search results is not representable in CSS, so such a pseudo seems somewhat unlikely to be useful.
Right. In the CSS meeting where the feature was discussed it was agreed that Safari would not implement due to a very different find-in-page display that already addresses page contrast and so on. I guess we're just asking if you're against other browsers implementing it.
I don't really think this is a good standard for the web, even if not implemented by Safari. This basically allows disabling find-in-page highlighting which isn't something desirable. Not only that, but it makes find-in-page UI inconsistent for users. Users should be first in the priority of constituencies and I'm not convinced this helps efficiently the user given its drawbacks. A more efficient solution to the contrast problem would be contrast enforced by the user agent, which maintains consistency and limits abuse potential.
See related comments: https://groups.google.com/a/chromium.org/g/blink-dev/c/U-6tIuuGtgo/m/3SdA3iFVDAAJ https://github.com/w3ctag/design-reviews/issues/1120#issuecomment-3232811373