Skip to content

[css-pseudo-4] single highlight pseudo for find-in-page? #10212

Closed
@delan

Description

@delan
  1. Do we really need two highlight pseudos, or would a pseudo-class like ::search-match:active make more sense? Since ::active-search and ::inactive-search sound like they would be mutually exclusive, this may just be a question of elegance, not ambiguity like in [css-pseudo-4] ::selection vs ::inactive-selection #4579.

#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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions