-
Issue occurs when you have a <DropdownMenu>
<DropdownMenuTrigger asChild>
<Button
variant="ghost"
className="flex h-10 w-10 p-0 data-[state=open]:bg-muted"
>
<DotsHorizontalIcon className="h-4 w-4" />
<span className="sr-only">Open menu</span>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-[160px]">
<DropdownMenuItem disabled={readonly} onClick={onClick}>{icon} {label}</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu> Simple reproduction, just add a dialog to the above and when the dialog opens you'll get the class added, blocking your UI. ![]() Ref: #1685 |
Beta Was this translation helpful? Give feedback.
Replies: 33 comments
-
This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you. |
Beta Was this translation helpful? Give feedback.
-
It's still an issue! I have to manually add a
I also tried manually passing open to it like so
which also doesn't work. This needs to be fixed! |
Beta Was this translation helpful? Give feedback.
-
Sure, this issue need to be re open, but this css work with me for temporary /* global.css */
body {
pointer-events: auto !important;
} |
Beta Was this translation helpful? Give feedback.
-
Also running into this. Hm. Does not seem fixed. |
Beta Was this translation helpful? Give feedback.
-
Bumping this because it's still an issue... |
Beta Was this translation helpful? Give feedback.
-
Experiencing the same problem. |
Beta Was this translation helpful? Give feedback.
-
Same here. Really sad because its annoying. The CSS-Trick will work, but I think this is not the best solution since it is a bug. |
Beta Was this translation helpful? Give feedback.
-
thanks bro its working perfectly |
Beta Was this translation helpful? Give feedback.
-
I you are using a Dropdown Item to trigger a modal, a simple solution to this problem is adding |
Beta Was this translation helpful? Give feedback.
-
Both the CSS modification 'fix' and // Track the state yourself
const [open, setOpen] = useState(false)
// Pass it to the DropdownMenu
<DropdownMenu
open={open}
onOpenChange={(isOpen) => {
setOpen(isOpen)
}}
>
// Close the dropdown before opening any modal
<DropdownMenuItem
onClick={() => {
setOpen(false)
pushModal('YourModal')
}}
> |
Beta Was this translation helpful? Give feedback.
-
I just came across this issue, it's something to do with how the AlertDialog works as this issue doesn't exist on a normal Dialog (I've not used the normal Dialog inside a drop-down menu yet though not 💯 sure) For now I've just added the CSS fix which seems to fix it but not sure about the long term effects. For some reason when you control the state yourself it's not performing the cleanup on the bodys pointer:events none styling which leads the entire UI unusable 🫠 Not a great fix bit it'll do as I spotted this at the last minute so it's good enough for now. |
Beta Was this translation helpful? Give feedback.
-
This did it for me. I was hesitant to try the pointer-events: auto !important; because of potential downstream effects. Thank you |
Beta Was this translation helpful? Give feedback.
-
This fixed my issue. |
Beta Was this translation helpful? Give feedback.
-
Did you still get the backdrop on the AlertDialog ? |
Beta Was this translation helpful? Give feedback.
-
This happens with a normal dialog for me too. I believe radix-ui/primitives#837. I don't believe it is fixed as of yet. Messing with the pointer events of the entire body might conflict with other dialog providers too, so I'd be interested in a solution that doesn't require that. |
Beta Was this translation helpful? Give feedback.
-
In my case the popovers where this was an issue were all under a top-level div with data-portal="true". So I just added this to my global CSS to fix it:
|
Beta Was this translation helpful? Give feedback.
-
December 2024 and the issue persist |
Beta Was this translation helpful? Give feedback.
-
Jan 2025 the issue persists |
Beta Was this translation helpful? Give feedback.
-
Yeah, this is really annoying :( |
Beta Was this translation helpful? Give feedback.
-
There's a temporary workaround in this thread somewhere, it's a Radix UI issue I believe |
Beta Was this translation helpful? Give feedback.
-
I was searching the whole day for a solution and this is the only one that works |
Beta Was this translation helpful? Give feedback.
-
Still not fixed |
Beta Was this translation helpful? Give feedback.
-
:v I also experienced problems |
Beta Was this translation helpful? Give feedback.
-
I wanted to share my observations again, as I’ve been monitoring this issue for quite some time. From what I understand, the problem seems to occur when multiple dialogs or popovers from different dependencies are layered or nested together. Example: As far as I know, all components that spawn dialogs or popovers rely on the There are also several related discussions in the Radix repositories that dig deeper into this problem. Specifically: I recommend looking into them, as some people were able to fix their issues by overriding the versions of specific radix dependencies. |
Beta Was this translation helpful? Give feedback.
-
Fixed the pointer-events issue by adding proper event handling in the DialogContent component. The fix involves:
Here's the relevant code change: <DialogPrimitive.Content
// ... other props ...
onCloseAutoFocus={(event) => {
event.preventDefault();
document.body.style.pointerEvents = '';
}}
> Shadcnui Dialog.tsx const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
className={cn(
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
className
)}
{...props}
onCloseAutoFocus={(event) => {
event.preventDefault();
document.body.style.pointerEvents = '';
}}
>
{children}
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<X className="h-4 w-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPortal>
))
DialogContent.displayName = DialogPrimitive.Content.displayName |
Beta Was this translation helpful? Give feedback.
-
I'm on December 24, 2025 and this error still persists. I placed the Dialog inside a DropdownMenu in my application, as the documentation instructs, and the same error occurred. I had to do the |
Beta Was this translation helpful? Give feedback.
-
FYI: The issue is caused by opening any portal, not just a dialog. It would be helpful to have a solution that is self contained to the dropdown. |
Beta Was this translation helpful? Give feedback.
-
This issue's root cause is conflicting Until the radix team fixes the issue, the easiest way to fix the issue without changing any portal/dialog/dropdown code is to re-align package versions:
"resolutions": {
"@radix-ui/react-dismissable-layer": "^1.1.5"
}
|
Beta Was this translation helpful? Give feedback.
-
For what it's worth I can see this issue still happening with react-dismissable-layer 1.1.5 and the current versions of react-context-menu and react-dropdown-menu (March 2025) I was able to fix the issue with dropdown menus by ensuring that |
Beta Was this translation helpful? Give feedback.
-
Ah, the context menu thing was a dependency issue. After re-installing modules, it works! |
Beta Was this translation helpful? Give feedback.
I you are using a Dropdown Item to trigger a modal, a simple solution to this problem is adding
modal={false}
to the DROPDOWN. Doing so will disable its modal behavior, which conflicts with the modal. This is a radix issue.