Open cloudinary upload widget inside a Shadcn UI dialog #3234
Replies: 5 comments 2 replies
-
Did you manage to find a way, i'm also facing this issue |
Beta Was this translation helpful? Give feedback.
-
Also facing this issue. |
Beta Was this translation helpful? Give feedback.
-
I have implemented a solution to handle interactions with an iframe created by upload widget using two main steps:
This implementation is a trade-off as it may reduce the isolation and focus that a modal Dialog typically provides. While it allows for interaction with the iframe, it also means the Dialog won't close automatically when clicking outside, potentially leading to a cluttered user interface if the user forgets to close it manually. |
Beta Was this translation helpful? Give feedback.
-
I just encountered a similar issue when clicking on an upload image button inside the Shadcn UI dialog. The Cloudinary upload widget appears above the dialog, but I can't interact with any of its elements. When inspecting the DOM, I noticed that the dialog's elements are still capturing the interactions, even though only the Cloudinary upload widget is visible. Clicking anywhere causes both the widget and the dialog to close. It seems that the Cloudinary upload widget is affected by the dialog's stacking context, causing it to be rendered behind the overlay. My simple fix was to create a custom modal using Example: {isModalOpen && (
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
className="fixed inset-0 bg-background/30 backdrop-blur-sm z-50 flex items-center justify-center"
>
<div className="gap-4 border bg-background rounded-lg shadow-lg max-w-xl md:max-w-3xl max-h-[420px] md:max-h-[450px] mx-8 md:mx-0 overflow-auto">
<div className="sticky top-0 left-0 right-0 h-fit w-full bg-background z-50">
<div className="flex items-center justify-between py-4 px-4">
<div className="flex flex-col mb-4 gap-y-2">
{/* Title */}
<h1 className="text-4xl font-semibold text-gray-900 dark:text-gray-100">
Your Title
</h1>
<p className="text-gray-500 dark:text-gray-400 font-medium text-[1rem]">
Your description ....
</p>
</div>
<Button
variant={'ghost'}
size={'sm'}
onClick={() => setIsModalOpen(false)}
className='p-2'
>
<X className='w-6 h-6' />
</Button>
</div>
</div>
<div className="flex flex-col items-center space-y-6 p-4">
<YourContenthere />
</div>
</div>
</motion.div>
)} |
Beta Was this translation helpful? Give feedback.
-
still having this issue. I see the workarounds, they are not pretty or easy. so bottom line is, you can't use the cloudinary upload widget inside shadcn/ui modal. that sucks. i'm still looking for solutions. |
Beta Was this translation helpful? Give feedback.
-
I've tried all different way to implement this, but each way just doesn't work.
The UI I want to try and achieve is that an original dialog should be open. And then when a user clicks on an upload image button then another dialog should be rendered on top of the old dialog (which of course Shadcn UI can do). But I want the Cloudinary widget to be opened inside this newly opened dialog, which sadly doesn't. The behaviour I currently have is that when the new dialog is opened. It's empty and then when I close it, the cloudinary widget flashes and also closes, taking me back to the old dialog. Any help on this?
Beta Was this translation helpful? Give feedback.
All reactions