← Back to release summary

highlightsFromPoint API

Category
CSS
Type
New or changed feature
Status
In development (Chrome In development)
Intent stage
None

Summary

The highlightsFromPoint API enables developers to interact with custom highlights by detecting which highlights exist at a specific point within a document. This interactivity is valuable for complex web features where multiple highlights may overlap or exist within shadow DOM. By providing precise point-based highlight detection, the API empowers developers to manage dynamic interactions with custom highlights more effectively, such as responding to user clicks or hover events on highlighted regions to trigger custom tooltips, context menus, or other interactive features.

Motivation

Highlights visually differentiate specific ranges within a document, such as comments, search results, or spelling errors. As web features grow more complex, managing custom highlights becomes increasingly challenging, particularly when dealing with overlapping highlights or content within the shadow DOM. Developers need a way to interact with individual highlights at precise points within the document, enabling more efficient control of dynamic and interactive content with custom highlights. This allows for features like displaying custom tooltips, context menus, or other interactive elements based on accurate point-based highlight detection.

Standards & signals

Explainers: https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/highlight/HighlightsFromPointsExplainer.md

View on chromestatus.com