ui icon indicating copy to clipboard operation
ui copied to clipboard

Possible breaking change with usePopoverPosition event propagation after upgrade to React 17

Open barrett-hln opened this issue 4 years ago • 1 comments

The window.addEventListener and window.removeEventListener calls in the following area may need the { capture: true } option added due to a change in how React 17 now attaches event listeners to the root app element. I was using this hook in a custom component that expected click events on other popover targets to bubble up (not calling event.stopPropagation) and trigger closing of the currently displayed popover. This stopped working properly after upgrading to React 17 seemingly due to the bubbling now only going up to the root app element.

https://github.com/paljs/ui/blob/c8054f0e939ffce2a263199fdeb964d49178af0a/packages/ui/src/utils/popoverPosition.ts#L142-L148

See https://reactjs.org/blog/2020/08/10/react-v17-rc.html#fixing-potential-issues

barrett-hln avatar Oct 26 '21 20:10 barrett-hln

Thanks for reporting. I will work on this issue and push new release asap.

AhmedElywa avatar Oct 27 '21 10:10 AhmedElywa