[css-highlight-api] Should Highlights affect shadow DOM text if their ranges' endpoints are in the light DOM?
Nobody has claimed this yet.
- Dominant language
- Bikeshed
- Stars
- 4.9k
- Forks
- 816
- PR merge metrics
- PR metrics pending
Description
It's not specified whether a Highlight which has a range with endpoints in the light DOM surrounding some text in the shadow DOM should affect it or not.
For example, let's say we set a Highlight with a range like the brackets below, where only the line in the middle is in the shadow DOM:
[0123456789
This line is in the shadow DOM
01234]56789
Live example here https://jsfiddle.net/ym78b5xk/
This would highlight text from first and third lines only, leaving the second line as it was before setting the Highlight. This behavior makes sense if we think that the range is in the light DOM, so it doesn't have information from the shadow DOM. The same behavior is observed from Range.toString(), where calling it on a range like the above returns text from the light DOM only.
I can think of (at least) three options here:
- Don't highlight shadow text.
- Highlight it.
- Extend the API for Highlight to be able to take extra parameters to decide if this is highlighted or not (maybe with an optional parameter with
ShadowRootsin a similar way as CSS.highlights.highlightsFromPoint()?)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the CSS Highlight API specification linked in the issue and reproduce the light-DOM/shadow-DOM case in the linked jsfiddle. Compare the proposed behaviors with Range.toString(), then resolve and document the chosen shadow-DOM behavior in the specification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100