Skip to content
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

modal components are incompatible with third-party modals #2219

Closed
ciampo opened this issue Jun 19, 2023 · 9 comments
Closed

modal components are incompatible with third-party modals #2219

ciampo opened this issue Jun 19, 2023 · 9 comments
Labels

Comments

@ciampo
Copy link

ciampo commented Jun 19, 2023

Bug report

Current Behavior

When using any components supporting the option to render as modal, other third-party pieces of UI that would need to also render as modal on top of the radix component stop working as expected, due to the pointer events / scroll / focus trap that Radix components create.

This makes it practically impossible to integrate Radix in existing projects, where not all UI elements are using Radix.

Furthermore, this also breaks browser extensions (like Grammarly or Google Translate) that would display additional UI when activated.

Expected behavior

There should be a way for third-party "Modal" content to render and be interactive of top of Radix's modal components.

Reproducible example

https://codesandbox.io/s/interesting-julien-9lr83p

Suggested solution

Additional context

Your environment

Software Name(s) Version
Radix Package(s)
React n/a
Browser
Assistive tech
Node n/a
npm/yarn
Operating System
@JesseKuntz
Copy link

Encountering the same issue. I've tried preventing default in onInteractOutside (and a few of the other options) but I've resorted to closing the Radix Dialog before opening the 3rd party modal, and opening the Radix Dialog again upon closing the 3rd party modal.

@ciampo
Copy link
Author

ciampo commented Jun 21, 2023

I've resorted to closing the Radix Dialog before opening the 3rd party modal, and opening the Radix Dialog again upon closing the 3rd party modal.

This may not be an option for all projects, especially when the entirety of the UI is not implemented using Radix. On top of that, browser overlays and browser extensions may not work properly too, which is not good.

@JesseKuntz
Copy link

I agree. I think we're just missing a way to remove the focus trap on demand.

@victorgaard
Copy link

I managed to make it work by setting the modal property of Dialog.Root as false, so I can interact with things on top of it, but now the Overlay won't show. 😅

I agree it would be nicer to just have an option to remove the focus trap on demand.

@AlexMNet
Copy link

@JesseKuntz @ciampo it was so much gymnastics just to get that too work properly I just created my own dialog. Haha. I am using the next-cloudindary widget to upload images which opens up in its own modal. Hopefully this will get fixed soon as this is a common scenario.

@magoz
Copy link

magoz commented Aug 15, 2023

I'm also encountering this issue. In my case, the issue is not being able to get pointer events when the Dialog is open.

@nacho-villanueva
Copy link

nacho-villanueva commented Sep 20, 2023

I'm having the same problem. I have a modal with a login form and all password managers like NordPass become unclickable cause the body sets pointer-events to none. Any updates on this? Seems quite like a pretty common scenario in general.

@nacho-villanueva
Copy link

nacho-villanueva commented Sep 20, 2023

A quick fix for me was to add this to the css:

body[style*='pointer-events: none'] > *:not(#app) {
  pointer-events: all;
}

(Thank you ChatGPT)

@benoitgrelard
Copy link
Collaborator

Duplicate of #1859

@benoitgrelard benoitgrelard marked this as a duplicate of #1859 Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants