/** * Shadow-DOM-agnostic `document.elementFromPoint` wrapper. Returns `null` * when the document doesn't expose the method (non-browser test env). * * 1:1 port of Base UI React's `packages/react/src/utils/getElementAtPoint.ts`. */ export function getElementAtPoint( doc: Document | null | undefined, x: number, y: number, ): Element | null { return typeof doc?.elementFromPoint === "function" ? doc.elementFromPoint(x, y) : null; }