Skip to content

CSS Custom Highlight API #1149

@dandclark

Description

@dandclark

Description

The custom highlight API provides a way for web developers to style the text of arbitrary text ranges without wrapping them with additional HTML elements. This is useful in a variety of scenarios, including editing frameworks that wish to implement their own selection, find-on-page over virtualized documents, multiple selections to represent online collaboration, or spellchecking frameworks.

The core API has shipped in all browsers, but test failures remain.
The scope proposed here also includes the newer API highlightsFromPoint, which can be used to make highlights responsive to user input. It's not yet implemented in Firefox or Safari.

Specification

https://drafts.csswg.org/css-highlight-api-1/

web-feature

https://web-platform-dx.github.io/web-features-explorer/features/highlight/

Test Links

https://wpt.fyi/results/css/css-highlight-api

Additional Signals

Use cases discussed with some developer commentary here: w3c/csswg-drafts#4307. CKEditor had also shown support from the early days of the highlight API explainer. Supportive comments on https://css-tricks.com/css-custom-highlight-api-early-look/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions