Re: [w3ctag/design-reviews] CSS.highlights.highlightsFromPoint API (Issue #1043)

ffiori left a comment (w3ctag/design-reviews#1043)

Hi @xiaochengh, thanks for following up on this topic by filing an issue. One of the reasons why we found this API to be worth pursuing is because it maintains the current patterns for developers (like other *FromPoint APIs, i.e. `elementFromPoint`, `caretPositionFromPoint`) so it's easier and intuitive for them to adopt it.

It's also up to the developers to call the API with a clean layout. We can give them some guidance by adding a note in the spec and in MDN mentioning this. We can also give an example like the following:

```
document.addEventListener('click', (event) => {
    requestAnimationFrame(() => {
        requestAnimationFrame(() => {
            const highlights = CSS.highlights.highlightsFromPoint(event.clientX, event.clientY);
            // Do something with the highlights
            console.log(highlights);
        });
    });
});
```


-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/1043#issuecomment-2686092069
You are receiving this because you are subscribed to this thread.

Message ID: <w3ctag/design-reviews/issues/1043/2686092069@github.com>

Received on Wednesday, 26 February 2025 20:14:24 UTC