-
Notifications
You must be signed in to change notification settings - Fork 219
Description
When updating a project from React16 to React17 run into an "issue" with the useRootClose.
Currently, the project has various buttons/icons that are getting used to trigger the show/hide of different Popovers, the Popovers are being displayed only one at a time, and I am using the useRootClose to close the popover on click events outside of them
I need to stop the propagation of the events when the user clicks the triggers (buttons/icons).
If the user clicks another trigger while a popover is open, the open
popover is getting closed and the new one is displayed, with the changes to event delegation introduced in React17, this is no longer happening since the stopPropagation()
is doing what it supposed to do.
Here are some examples
React 16: https://codesandbox.io/s/rootclose-stoppropagation-react16-tp7p9
React 17: https://codesandbox.io/s/rootclose-stoppropagation-react17-wckle
Potential Fixes:
Adding an option to the useRootClose
so the onRootClose
method can be fired on the capture phase as suggested on Fixing Potential Issues
I haven't found any workaround for it yet, besides removing the stopPropagation()
that will not work for my use case.