align
align copied to clipboard
`monitorResize` function doesn't work with ShadowDOM.
function onResize([{ target }]: ResizeObserverEntry[]) {
if (!document.documentElement.contains(target)) return; // <-- always return false when in ShadowDOM
const { width, height } = target.getBoundingClientRect();
const fixedWidth = Math.floor(width);
const fixedHeight = Math.floor(height);
https://github.com/react-component/align/blob/master/src/util.ts#L36C5-L36C60
I cannot let the dropdown popup attach outside the ShadowRoot because of style conflicts. Need to add a judgement about whether the target element is in a ShadowRoot which belongs to the currentDocument.