w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.52k stars 673 forks source link

[cssom-view] ShadowRoot should also have elementFromPoint and elementsFromPoint #5886

Open foolip opened 3 years ago

foolip commented 3 years ago

https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface defines elementFromPoint and elementsFromPoint methods on Document, but Chromium, Gecko and WebKit all have these members in the DocumentOrShadowRoot mixin: https://chromium.googlesource.com/chromium/src/+/5aded22f34131a7d136f7fff2b6b28b8387ad961/third_party/blink/renderer/core/dom/document_or_shadow_root.idl https://hg.mozilla.org/mozilla-central/file/a2507ffc9d4db5109a491d91f4c4c1e5a8dd0e2e/dom/webidl/DocumentOrShadowRoot.webidl https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/DocumentOrShadowRoot.idl?rev=271743

The net effect is that they're on ShadowRoot, not just Document, but that no spec seems to capture this.

cc @annevk @mfreed7 @rniwa

annevk commented 3 years ago

See https://github.com/w3c/csswg-drafts/issues/556#issuecomment-369034051 onward.

Haprog commented 2 years ago

The Shadow DOM spec used to declare that DocumentOrShadowRoot is extended with elementFromPoint and elementsFromPoint. Here's the latest web archive snapshot that still says so: https://web.archive.org/web/20180228173001/http://www.w3.org/TR/shadow-dom/

It seems that was since changed to a short page that basically just says:

Shadow DOM specification is being incorporated into to the DOM specification, HTML specification, CSS Scoping Module Level 1, UI Events specification, and other relevant specifications.

I guess that was related to https://github.com/WICG/webcomponents/issues/661 but I'm also very confused by where did that definition go.

The only current spec mentioning elementFromPoint and elementsFromPoint that I could find now is the CSSOM View Module draft that specifies them on the Document only.

rniwa commented 1 year ago

We should also add caretPositionFromPoint to ShadowRoot as well.

sanketj commented 2 months ago

Supporting shadow DOM content in elementFromPoint/elementsFromPoint came up again during the TAG review for caretPositionFromPoint: https://github.com/w3ctag/design-reviews/issues/949. In terms of API consistency, updating elementFromPoint/elementsFromPoint makes total sense. Do we have any signals about developers wanting this?

captainbrosset commented 2 months ago

Supporting shadow DOM content in elementFromPoint/elementsFromPoint came up again during the TAG review for caretPositionFromPoint: w3ctag/design-reviews#949. In terms of API consistency, updating elementFromPoint/elementsFromPoint makes total sense. Do we have any signals about developers wanting this?

Filed https://github.com/w3c/csswg-drafts/issues/10992 to cover this.