Skip to content
This repository was archived by the owner on Nov 4, 2025. It is now read-only.
This repository was archived by the owner on Nov 4, 2025. It is now read-only.

monitorResize function doesn't work with ShadowDOM. #298

@LPegasus

Description

@LPegasus
  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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions