[csswg-drafts] [cssom-view] Allow elementFromPoint and elementsFromPoint to traverse shadow roots (#10992)

captainbrosset has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom-view] Allow elementFromPoint and elementsFromPoint to traverse shadow roots ==
I recently asked on Mastodon if folks knew the `element(s)FromPoint()` methods and whether they'd want them to be able to traverse shadow roots: https://mas.to/@patrickbrosset/113236606097090887

Some replies to my "Do you wish it would across Shadow DOM boundaries "question:

> In my use case, whether I want it to cross Shadow DOM boundaries would depend on how "thick" the custom elements are. If thin, I wouldn't care. If they encompassed too much in the page, then yeah I'd want a more fine-grained approach.

> YES

> ABSOLUTELY YES

> I'm not sure whether it should cross shadow boundaries on its own. I could maybe see an option, so you had to do work to get through, but didn't need to write your own recursive method.

> I think I’d want to be explicit about getting any element from within a shadow root, so maybe if there was an option to include shadow roots.

> Absolutely yes! Eventually, it could be a parameter option, like `document.elementsFromPoint({ composed: true })` or similar.

Note that `caretPositionFromPoint` already works this way: https://developer.mozilla.org/en-US/docs/Web/API/Document/caretPositionFromPoint#shadowroots

Also, during the TAG review for `caretPositionFromPoint` @LeaVerou said (https://github.com/w3ctag/design-reviews/issues/949#issuecomment-2186090703):

> I would reiterate that elementFromPoint() could also be expanded in the same way for consistency (and I suspect there are plenty of use cases for that too).

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10992 using your GitHub account


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

Received on Wednesday, 2 October 2024 14:24:36 UTC