-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Popup: when multiple popups present, click on the other trigger doesn't close original popup #3006
Comments
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. |
Hello guys, First, thanks for your amazing work ! |
Yep, feel free to pickup any issue marked as |
This line seems to be responsible. When adding the event to the second trigger, it is removing the targetHandler of the first one, hence removing its document listener (for a "click" in our case). |
Yep, it's hard to describe, but you can try to remove/move this line and check how it affects |
Indeed, it is harder to comprehend than expected. From my investigation, removing and adding that handler on the second portal mount prevents the first one to receive the A lazy solution would be to avoid sharing an |
The thing is that components like I think the eventStack -> eventTarget -> eventPool -> eventSet system is flawed for these cases. It would work if each component added/removed themselves their own callbacks to the document. What do you guys think ? |
Hi there, good job investigating! I discovered this bug with |
Hello guys, is there a plan / direction to solve this bug ? I could work on it if we agree on a solution. |
@lucmerceron I would be grateful if anybody could solve it |
@lucmerceron I'm currently busy with my paid work. EventStack was moved to the separate repo. The solution is reorder and change event subscribing, more details are there #3124 (comment). The help is much appricated. It seems that we will have issues with |
I think I've been experiencing this bug in my app. The JSX looks something like:
What I find interesting is that the first dropdown is closed OK. It's the second dropdown that doesn't close. But only if the second dropdown opening action caused another dropdown to close. Perhaps this little tidbit will help with debugging. I can also test any solutions against my codebase to verify a fix. Good luck, this one doesn't seem easy! |
This issue is very critical to our application. Can anyone help? Thanks |
@ivanjiang5628 make popup controlled |
It's the high priority issue to me, I will work on it at the current week. The next release should contain the proper fix. |
@dmitriyshmatov Thanks for replying I can solve this problem by adding "force update" and "force update onChange function" states to the parent component and then passing them to the child components (Popups) as props, but it will significantly slow down the rendering speed of the application due to multiple renderings. @layershifter Thank you |
Manually checked the new release, the issue is fixed in |
Bug Report
This seems to be the same issue that was reported #1251 But it got back with new versions.
Steps
Create several popups with a click trigger.
Click first trigger --> first popup opens, then click second trigger --> the second opens, but the first stays open.
Expected Result
The first popup should be closed when the second trigger clicked.
Actual Result
The first popup stays open.
Version
0.82.0
Testcase
https://codesandbox.io/s/3rx96jzjr6
The text was updated successfully, but these errors were encountered: