-
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] DialogContent
disables pointer events for the whole page which might conflict with 3rd party modals
#2122
Comments
I also faced the same problem when I integrated the recaptcha from google My solution was: onClick={() => {
setIsDialogVisible(true)
setTimeout(() => (document.body.style.pointerEvents = ""), 0)
}} |
We are experiencing this exact same issue too. Our app relies on multiple different external modals that can be opened while Radix UI dialog is open. Is there any reason for the |
I having this issue too! Also can confirm that version 1.0.2 does not have the problem, so people may consider downgrade until it is fixed. |
Hey all,
The issue is you are thinking about modality only from the POV of The easiest solution to the 3rd party component being open from one of our modal components would be to set We could try and find a solution from our side where you wrap the 3rd party lib with something, but I fear it will be difficult to generalise as other 3rd party might portal somewhere else, etc. So ultimately doing it yourself on a case by case (these are edge cases too) it probably the best solution. |
@benoitgrelard The issue with Stripe is that it doesn't allow to set a custom container or customize it. We don't have control over it. I think allowing to set
I don't get it how it's related to It's not a common case to see |
Because modality is a general concept which applies in more than dialogs. The stripe dialog could be opened from a
I get that but many implementations of modality in the wild are very naïve and incomplete IMO.
There must be a way to get to the node right? A CSS selector, some DOM traversal, etc. There's always a way really. I will keep thinking on my side if there are other ways. |
Thank you for clarifying.
In case of Stripe, they don't set document.querySelector('iframe[name^="__privateStripe"]').parentNode
👍 |
Wouldn't targeting the iframe itself be enough? |
@benoitgrelard Stripe creates several iframes already and also a new one for 3D secure. I'm going to just changing
I think that's the easiest and quete safe solution for now. |
Had this same issue with Stripe modals today. @lesha1201's solution above was the simplest.
This assumes you set |
This happens when the Dialog is opened under Popover / Dropdown. this issue is still present, couldn't find a clean solution in 2024. After closing the dialog, it will block the entire ui (when used under popover / dropdown) Can you kindly look into this case? @benoitgrelard should I open a new issue? seems related and unresolved. Screen.Recording.2024-03-13.at.9.43.17.AM.mov |
I am trying to use react-select with Radix dialog and I had to make the select menu rendered on a portal in my use case. Because of |
I'm facing the same issue. Where exactly did you portal the menu? I'm able to select the items in the menu but I'm unable to scroll the menu using the mouse scroll wheel. |
Thanks! This was a quick fix for us when using Yet Another React Lightbox |
Thank you so much. It fixes my issue using shadcdn. const [modalOpen, setModelOpen] = useState(false);
useEffect(() => {
if (modalOpen) {
// Pushing the change to the end of the call stack
const timer = setTimeout(() => {
document.body.style.pointerEvents = '';
}, 0);
return () => clearTimeout(timer);
} else {
document.body.style.pointerEvents = 'auto';
}
}, [modalOpen]); <Dialog modal={true} onOpenChange={(open) => setModelOpen(open)}> |
Due to this issue, it is borderline impossible to integrate google recaptcha within a modal dialog. |
Why was this issue closed? |
This issue was resolved for me by aligning package versions. I did this after reading #1088. |
I have fixed the issue by using the modal prop in the Dialog component.
By setting modal to false, everything works fine. |
I was having issues with setting So another solution that worked for my case was to include the following on my CSS:
|
Bug report
Current Behavior
When
DialogContent
is modal, it hasdisableOutsidePointerEvents={true}
which setspointer-events: none
. And because of that modals from 3rd parties might not work properly when they're open from the dialog. For example, I need to implement a dialog for adding a payment method in Stripe. Stripe.js can open their dialog in some cases, for example, in case of 3D secure.Desktop.2023.05.01.-.19.43.14.02.webm
Suggested solution
I think we should allow to specify
disableOutsidePointerEvents
forDialogContent
. There are several reasons for that:DialogOverlay
which covers the whole page.It should be easy to allow to specify that prop.
The text was updated successfully, but these errors were encountered: