react-bootstrap / react-overlays

Utilities for creating robust overlay components
https://react-bootstrap.github.io/react-overlays
MIT License
897 stars 222 forks source link

Support useRootClose inside open shadow roots #1005

Closed charlesroelli closed 2 years ago

charlesroelli commented 2 years ago

Describe the bug

useRootClose doesn't work inside a shadow root as it inspects Event.target instead of Event.composedPath()[0], miscalculating the clicked element as the event is re-targeted to the shadow host.

To Reproduce

Revert the change to src/useRootClose.ts in #1004, and run the new tests.

Reproducible Example

See the fix + test added in #1004.

Expected behavior

useRootClose should work correctly in shadow roots.

Screenshots

Environment (please complete the following information)

Additional context

Add any other context about the problem here.

kyletsang commented 2 years ago

Fixed in #1004