align icon indicating copy to clipboard operation
align copied to clipboard

`monitorResize` function doesn't work with ShadowDOM.

Open LPegasus opened this issue 1 year ago • 0 comments

  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.

LPegasus avatar Jul 11 '24 10:07 LPegasus