Re: [csswg-drafts] [css-highlight-api] Should pseudo-classes work with Custom Highlights (#7647)

I have recently had to implement this by myself by tracking the mouse position over the page and check whether the pointer is over one of the highlighted ranges, to dynamically change the background on hover:

https://github.com/user-attachments/assets/82291970-b140-4e1f-8510-70850bcf4311

It would be useful to have two types of hover states:
- when hovering over one of the ranges part of the highlight, the whole highlight gets the hover state
  - Example use case: you have an annotation over some non-contiguous text in the document, and you want to highlight all of the parts when you hover over it
- when hovering over one of the ranges, only that specific range gets the hover state
  - Example use case: you are using the same highlight "name" for multiple separate pieces that should have the same style (for example, all syntax errors in a code editor), and when you hover over them you want to highlight only one

-- 
GitHub Notification of comment by nicolo-ribaudo
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7647#issuecomment-2442125272 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 28 October 2024 16:53:36 UTC