You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sanket Joshi (@sanketj) This looks pretty good, thanks. I'm concerned about this being only available on Pointer Events, though. Regular old mouse events should ideally be supported here, too.
const findHighlights = new HighlightRangeGroup()
CSS.highlights.set("find-highlights", findHighlights)
// simulated find result for the word "highlight"
const text = document.getElementById("content").firstChild
const range = new Range();
range.setStart(text, text.length - "highlight".length)
range.setEnd(text, text.length)
findHighlights.add(range)
// on click of a range in the find-highlights group, move selection
// to coincide with the result
findHighlights.addEventListener("click", e => {
const range = e.range
const selection = getSelection()
selection.removeAllRanges()
selection.addRange(range)
})
Activity
frivoal commentedon Jun 28, 2019
That sounds useful, but shouldn't we aim to solve it for all css-pseudo elements rather than special-case it for highlight pseudos?
sanketj commentedon Aug 30, 2019
Hi Theresa O’Connor (@hober) , thanks for your feedback here! We have put together an explainer to address this scenario: https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/highlight/events-explainer.md. It proposes a new type of pointer event for highlighted ranges.
We would appreciate if you could go through it and provide any additional feedback that you may have.
hober commentedon Sep 16, 2019
Sanket Joshi (@sanketj) This looks pretty good, thanks. I'm concerned about this being only available on Pointer Events, though. Regular old mouse events should ideally be supported here, too.
sanketj commentedon Sep 16, 2019
Theresa O’Connor (@hober) HighlightRangeGroup would support all MouseEvent types, and all PointerEvent types except gotpointercapture/lostpointercapture: (https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/highlight/events-explainer.md#event-types). The example in the explainer - repasted below - shows how the API may be used with click:
hober commentedon Sep 16, 2019
Oh, okay. Yeah, that seems reasonable to me.
sanketj commentedon Sep 18, 2019
Thanks Theresa O’Connor (@hober) . I guess I'll close this issue out, and we can open up new issues on specific details based on our F2F discussions.