const customElem = document.querySelector("my-custom-element");
const shadow = customElem.shadowRoot;
const elements = shadow.elementsFromPoint(20, 20);
const msg = elements.map((el) => el.localName).join(" < ");
if (msg) {
console.log(msg);
} else {
console.log("The custom element had no descendants at x: 20, y: 20.");
}ShadowRoot: elementsFromPoint() method / notebook
ShadowRoot: elementsFromPoint() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.