Replies: 2 comments 1 reply
-
May be related to #2611 |
Beta Was this translation helpful? Give feedback.
-
This is more of an orchestration issue not a bug per say. Let me explain The ProblemThis behavior occurs because we assume that dialogs are nested in most cases, not siblings.
Child dialogs are closed when the parent dialog is closed. Hovercard, Popover, and Dialog are considered dialogs. The general recommendation is to close a parent dialog before opening the child dialog. The FixFor this use case, you don't need to use the <Teleport v-if="dialog" to="body">
<div class="fixed right-0 top-0 z-50">
<div
role="dialog"
class="h-dvh w-[20rem] overflow-y-auto overscroll-contain bg-slate-100 shadow-[-2px_0_6px] shadow-zinc-500/10 ring-1 ring-zinc-200"
>
<div class="flex bg-slate-200">
<button
@click="() => (dialog = false)"
class="inline-flex items-center justify-center gap-x-1 px-2 text-base ml-auto"
>
×
</button>
</div>
<div>Hello World. You just opened an Ark UI Dialog.</div>
</div>
</div>
</Teleport> Here's a demo: https://stackblitz.com/edit/vitejs-vite-my3utg?file=src%2FApp.vue Additional ContextWe would need to think deeply about supporting sibling dialogs because orchestrating sibling/non-sibling dialogs is a complex use case. At this point, I should consider adding this to the docs. |
Beta Was this translation helpful? Give feedback.
-
Description
Having a
HoverCard
that has items inside that opens aDialog
will either:Dialog
, but then close it whenHoverCard
closes itselfI wasn't able to figure out why sometimes it opens
Dialog
as expected, and sometimes it toggles it on and off immediately. And I definitely couldn't figure out whyHoverCard
events affects theDialog
.One thing to note, if I make a logic that allows
Dialog
to be opened first and then interact with theHoverCard
items, theDialog
will remain open at all times - which is good.Just for a reference,
HoverCard
is uncontrolled andDialog
is controlled.Export-1725953655882.mp4
Link to Reproduction (or Detailed Explanation)
https://stackblitz.com/edit/vitejs-vite-h7lvq6
Steps to Reproduce
I can open Modal #(x)
HoverCard
Ark UI Version
3.11.0
Framework
Browser
All
Additional Information
I also tried
Popover
instead ofHoverCard
and it will behave the same. It will close the dialog automatically, when I close thePopover
.Beta Was this translation helpful? Give feedback.
All reactions