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

[Bug]. Dialog and Popover conflict #3142

Open
xkomiks opened this issue Sep 26, 2024 · 2 comments
Open

[Bug]. Dialog and Popover conflict #3142

xkomiks opened this issue Sep 26, 2024 · 2 comments

Comments

@xkomiks
Copy link

xkomiks commented Sep 26, 2024

Bug report

Current Behavior

  1. Open CodeSandbox.
  2. Click the Dialog button.
  3. The Dialog element will open.
  4. Inside the dialog, click the Popover.
  5. The Popover will open.
  6. Select any element from the Popover dropdown.
  7. The Popover and Dialog will close, but the Dialog.Overlay remains visible.

Expected behavior

When opening a popover over a modal window, the focus is moved to popover.

When clicking on Dialog.Content, the popover closes
When clicking on Dialog.Overlay, the popover and dialog close

Reproducible example

https://codesandbox.io/p/sandbox/radix-ui-dialog-forked-mgrzrd?workspaceId=a4b71791-adc5-4752-b50f-7be66d4db979

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
@jfbn
Copy link

jfbn commented Oct 7, 2024

I'm trying to open a Drawer from a popover. I want to close the popover when I open the drawer. Doing so programatically, with a controlled open prop on the popover, will also close the drawer. Undesired behaviour.

@hoisharka
Copy link

This issue arises not only with Popover but also when using third-party modals together.
Setting pointer-events: none on the body is an excellent solution for preventing body scrolling while the Dialog is open, but it causes other modals to malfunction.

To resolve this, the automatic closing behavior in onPointerDownOutside should be prevented with preventDefault, and pointer-events: auto should be applied to Popovers or third-party modals for proper functionality.
(Simply removing pointer-events: none from the body would leave the scrolling issue unresolved.)

Since this currently requires manual customization, it would be better if this were provided as an option or if a more user-friendly solution could be explored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants