Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events propagate through Portals in Overlay elements #6124

Closed
adidahiya opened this issue May 4, 2023 · 0 comments · Fixed by #6093
Closed

Events propagate through Portals in Overlay elements #6124

adidahiya opened this issue May 4, 2023 · 0 comments · Fixed by #6093

Comments

@adidahiya
Copy link
Contributor

adidahiya commented May 4, 2023

Environment

  • Package version(s): core v4.18
  • Operating System: macOS
  • Browser name and version: Chrome

Code Sandbox

https://codesandbox.io/p/sandbox/awesome-mountain-njbt9k?file=%2FREADME.md

Steps to reproduce

  • Render a <Dialog> on top of an interactive element.
  • Interact with the background element through the Dialog.

Actual behavior

Events bubble through React Portals as per the docs

See facebook/react#11387

2023-05-03 20 13 00

Expected behavior

There should be a way to capture all events in Portals, preventing them from propagating to the rest of the DOM.

Possible solution

  1. add a boolean prop to PortalProps and OverlayableProps to capture all events at the Portal and prevent them from bubbling up the tree
  2. add a prop which supports a list of event types to capture at the Portal, like [core] feat(Overlay, Portal): allow portal to stop event propagation #6093
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant