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

Bug: Event handling with portals is broken #28863

Open
sag-tobias-frey opened this issue Apr 18, 2024 · 0 comments
Open

Bug: Event handling with portals is broken #28863

sag-tobias-frey opened this issue Apr 18, 2024 · 0 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@sag-tobias-frey
Copy link

Event handling with portals is broken in the newest version when placing non-react event handlers BETWEEN other react event handlers. With the following setup outer react event handler with stopPropagation > non-react event handler > inner react event handler (in portal). Doing the same without portals works correctly.

React version: 18.2.0

Steps To Reproduce

With portal (not working)

  1. https://stackblitz.com/edit/ag-grid-react-hello-world-kag1v7?devtoolsheight=33&file=index.js
  2. Click on the div
  3. Only inner and outer event handlers are called

Without portal (working)

  1. https://stackblitz.com/edit/ag-grid-react-hello-world-gi5bmo?devtoolsheight=33&file=index.js
  2. Comment out the portal code and comment in the non-portal code (line 24 / 25)
  3. Click on the div
  4. All three event handlers are triggered

Link to code example: https://stackblitz.com/edit/ag-grid-react-hello-world-gi5bmo?devtoolsheight=33&file=index.js

The current behavior

Non-react event handlers are not called when the initial event is initiated from a portal component and an outer react event handler calls stop propagation. This works correctly without portals.

The expected behavior

The non-react event handler should also be called when a portal component initiates the event.

Original issue

#20901 was closed due to inactivity but is still valid in the newest version, see updated code examples.

@sag-tobias-frey sag-tobias-frey added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

1 participant