Setting closeOnInteractOutside Prop to FALSE in Popover Inside Dialog Closes Dialog Unexpectedly #2611
Replies: 2 comments 4 replies
-
I don't understand what this reproduction is meant to showcase. From a UX perspective, why would you want to open a popover without opening the dialog first? It feels like an inversion of control here. From a technical perspective, the dialog + popover establish a nesting hierarchy when they're open. In this case, the state machine is designed to assume the popover is the parent of the dialog. Closing the parent layer (popover) in the hierarchy also forces the child layer (dialog) to close. This is what is happening. We could expose a callback to help folks debug/disable this behavior. For now, I recommend opening the dialog first and then immediately opening the popover. |
Beta Was this translation helpful? Give feedback.
-
This is my use case: I have a module in my dashboard. The module has a settings popover trigger inside it. It also has a fullscreen button which opens up a dialog with just the module. If the settings popover is already open on the dashboard module and the user clicks the fullscreen button, the fullscreen module should have the settings popover open as well. Essentially I'm trying to sync up the two popover states, hence I'm setting a hidden popover inside the fullscreen dialog module whenever the dashboard popover opens or closes. The reason I need to set the closeOnInteractOutside prop to false is because I don't want outside interactions on the inactive popover to hide the main popover. Anyways thanks for the help 👍 I believe I can work something out with sequenced state rendering/the example you posted, though it still feels a little weird that the original issue only occurs when closeOnInteractOutside is set to false. |
Beta Was this translation helpful? Give feedback.
-
Description
I put a popover inside a dialog component. Triggering a control for the popover closes the parent dialog unexpectedly if the popover has closeOnInteractOutside set to false.
Link to Reproduction (or Detailed Explanation)
https://stackblitz.com/edit/vitejs-vite-hjte8q?file=src%2FApp.tsx
Steps to Reproduce
Test.Dialog.State.-.StackBlitz.-.Google.Chrome.2024-06-27.10-34-27.mp4
Ark UI Version
3.4.0
Framework
Browser
Chrome
Additional Information
Seems to be a bug because the Dialog is closing unexpectedly even though it is controlled, non-portalled, and has closeOnInteractOutside to false, so shouldn't have anything to do with focus transfering.
After further testing, it seems like removing the closeOnInteractOutside prop in the popover component seems to fix this issue, which further convinces me that this is a bug since it has nothing to do with the actual parent dialog.
Beta Was this translation helpful? Give feedback.
All reactions