-
Notifications
You must be signed in to change notification settings - Fork 719
[css-pseudo-4] single highlight pseudo for find-in-page? #10212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm not really sure that having Find pseudos is going to work very well. The current behavior in Safari is that when you do a Find and there are results, the current result is selected (using normal DOM selection), and the UA draws an overlay where the current find result gets a yellow bubble (which entirely obscures whatever the page renders). If the user dismisses the Find overlay, then the result remains selected, so that it can be copied, for example. Now if the page author styles |
I expect that in Safari the find-in-page pseudo will be ignored. I would expect it to only apply when a search is active, but there the browser has a specialized UI, and it would disappear when the selection takes over in Safari. The only alternative I can think of would be to disable the overlay interface and use Chromium/Gecko behavior when a find-in-page pseudo is present, but I certainly wouldn't advocate for that as good for users. Firefox also has a search highlight color that switches to selection, and I would expect the pseudo that is used to switch also from find-in-page to selection. This suggest the spec should use the appropriate "... browsers may ..." language. |
The CSS Working Group just discussed
The full IRC log of that discussion |
Resolved from CSSWG - w3c#10213 (comment) - w3c#10212 (comment)
See #10475 Co-authored-by: Jihye Hong
#3812 suggests adding two new highlight pseudos, ::active-search and ::inactive-search, for find-in-page search results. But these highlights are mutually exclusive, so they need not be two separate pseudo-elements and highlight overlays.
We propose instead adding a single highlight pseudo with a pseudo-class (selectors #pseudo-element-states), such as
::search-text:active
. You would select::search-text
for all matches,::search-text:active
for the active match, or::search-text:not(:active)
for the other matches.The exact naming is not critical, but
::search-text
would be by analogy with::target-text
, and clearly describes the thing being highlighted (like::spelling-error
), more so than alternatives like::search-match
or::find-in-page
.The text was updated successfully, but these errors were encountered: