-
Notifications
You must be signed in to change notification settings - Fork 800
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
[Dialog] body pointer-events: none remains after closing #1241
Comments
Hi @413n, I can reproduce the bug using your sandboxes. |
@benoitgrelard Seems like this is the same as #1236. Since this one has a working example already, should we close the other one? 👍🏻 |
I've been wondering too, but I haven't verified fully that it is indeed the same. |
I use the AlertDialog and have the same question. |
I am still able to replicate this in Looking into it. |
* [DismissableLayer] Fix pointer-events issues Fixes radix-ui#1241 Fixes radix-ui#1263 * PR feedback * Add cypress tests * testing flake * Fix flake? * Fix false positive * Copy change
@benoitgrelard has this been fixed? we're experiencing this at calcom/cal.com#2328 |
Hey @PeerRich yes it has been fixed and released as part of the v1 release. Have you upgraded? |
I got this issue when I opened a dialog on click in a dropdown menu. I solved it before I found this thread by setting a timeout in the onclick function before opening the dialog so it has time to reset styling set by the dropdown menu. Will however see if upgrades solves it so I wont need a timeout. |
I am still experiencing this issue when using an animated menu in combination with an animated dialog, and I have identified the root cause: This occurs whenever you have multiple copies of @radix-ui/react-dismissable-layer in your tree, because that package relies on some global state to track when to remove the pointer-events rule from the <body>, and that global state is not shared across multiple copies of the module. Others experiencing this issue: You can avoid it by making sure there is only 1 copy of @radix-ui/react-dismissable-layer in your build output.
Maintainers: An ideal solution would be for @radix-ui/react-dismissable-layer to still function, even when multiple copies of the module are in use - I think this is achievable. Also, the reproduction case given by @hipstersmoothie in #1241 (comment) looks like it's showing yet another reason why pointer-events can get stuck? |
I am also running into this issue. I double-checked our bundle and confirmed that we only have one I forked @hipstersmoothie's codesandbox demo and updated the versions to demonstrate that it's still reproducible with the latest versions: https://codesandbox.io/p/sandbox/dropdownmenu-dialog-items-forked-94x39v?file=%2Fsrc%2FApp.js Repro steps:
I believe this is the best way to demonstrate the bug, although in our app we are seeing the bug occur with a dropdown within a dialog, both dismissed at the same time roughly equivalent exit animation durations. @benoitgrelard Sorry for the ping, but we've seen this manifest in multiple ways (e.g dialog as child of dropdown, vice versa) and it does have a disastrous effect on the app as it renders it unresponsive to all pointer events. In the meantime, I am going to implement this workaround (thanks @brandalx). This is what I ended up with in useEffect(() => {
if (!open) {
setTimeout(() => {
document.body.style.pointerEvents = ''
}, 500)
}
}, [open]) Thank you to the maintainers and contributors of Radix! We are thoroughly pleased thus far. |
I'm experiencing the same issue in my project, though it happens with a popover inside a modal dialog. When I open the popover and then close the dialog, everything becomes unresponsive, just as you described. The workaround you mentioned also works for me, but I agree it seems a bit hacky. It would be ideal to get this bug fixed properly as soon as possible, especially since I see it's been around for a while. As developers, having these basic functions work reliably is crucial so we don't negatively impact the user experience. I hope the Radix devs can get this sorted out soon. |
Hey folks - just seconding that this appears to be an ongoing issue. Don't have a perfect repro example but I'm using the dropdown as an actions menu on a table. Appreciate your work on Radix but would be awesome if you could take a look at this one! Thanks |
Having this issue as well with the latest version. To fix, I found that you can simply wire up the
|
In my case I have found this happens when you attach a close animation to the overlay, and that it also causes the overlay not to be removed. This doesn't happen without the close animation. Using version |
Hi @benoitgrelard, should this one be re-opened? It seems it's still happening to quite a few people. Thanks. |
Hi @benoitgrelard, this is still an issue. Any updates/progress? Appreciate the help. |
@dimaMachina I was also having the same issue with |
setting |
Setting |
why was this issue closed? |
related #2122 |
This issue was resolved for me by aligning package versions. I did this after reading #1088. |
it works for me thank you @TranquilMarmot |
The simple |
Hi Guys! |
this does work if I remove node_modules and lock file. |
This package is the problem when you have different versions of it as dependencies of your radix-ui elements (check package-lock.json). My solution was deleting Now all |
In my case I'm using <ContextMenu key={item.fileId} modal={false}>
...
</ContextMenu> |
Update of April 2024
This bug seems to be still appearing in newer versions. You will find some workarounds in the recent comments. ⬇️
Bug report
Current Behavior
With
Dialog
version 0.1.7 the pointer-events seems to remain on thebody
with the Chrome device emulator using a mobile device (e.g. iPad Air), while in the 0.1.6 it works fine.Expected behavior
The pointer-events should always be removed from the body after the closing animation has finished.
Reproducible example
The 2 repos are identical, except the
@radix-ui/react-dialog
version:Additional context
I forked the
radix-ui/design-system
repo on codesandbox to reproduce this bug keeping the original code but changing just the version of the@radix-ui/react-dialog
.Note: In the version 0.1.7, the problem should be solved by removing the
close
animation from the ContentThe text was updated successfully, but these errors were encountered: