Skip to content

Panning does not work in external window #537

@yangwooseong

Description

@yangwooseong

Describe the bug

Panning does not work in external window.

To Reproduce
Steps to reproduce the behavior:
You can reproduce in https://codesandbox.io/s/still-leaf-t3shu (which is originally posted in #93)

Expected behavior
Panning should work in external window.

Additional context
I have done some test in cloned repo in dev mode, and I noticed diff in https://github.com/BetterTyped/react-zoom-pan-pinch/pull/448/files may not be correct change.

const targetIsShadowDom = "shadowRoot" in target && "composedPath" in event;
const isWrapperChild = targetIsShadowDom
? event.composedPath().some((el) => {
if (!(el instanceof Element)) {
return false;
}
return wrapperComponent?.contains(el);
})
: wrapperComponent?.contains(target);

  1. in operation returns true regardless of shadowRoot even though the value is null so I think nullability has to be checked.
  2. If it's on the shadowRoot or external window, instance of Element is always false because every environment has its own internal class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions