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

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

Open
barrett-hln opened this issue Oct 26, 2021 · 1 comment
Assignees

Comments

@barrett-hln
Copy link

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.

window.addEventListener('resize', positionHandle);
window.addEventListener('orientationchange', positionHandle);
layout.addEventListener('scroll', positionHandle);
window.addEventListener('click', onClickHandle);
if (props.eventListener) {
document.querySelector(props.eventListener)?.addEventListener('scroll', positionHandle);
}

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

@AhmedElywa AhmedElywa self-assigned this Oct 27, 2021
@AhmedElywa
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants