Opening Healdess UI Dialog (Modal) via another Dialog (Modal) closes the previous Dialog (Modal) automatically? (Added CodeSandBox reproduction link) #3199
Replies: 1 comment
-
I solved it by placing the DialogPanel2.vue inside the DialogPanel1.vue:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using the
HeadlessUI/Vue
component in myNuxt 3
application to build the Dialog/Modals. I am using the latest version"@headlessui/vue": "^1.7.22"
and developing in Chrome latest browser.I am creating a
DialogPanel1.vue
using theheadlessui/vue
. I have a button inDialogPanel1.vue
on clicking it I am opening theDialogPanel2.vue
but withinDialogPanel2.vue
when I click anywhere then it automatically closes theDialogPanel1.vue
which is behind theDialogPanel2.vue
.Minimal reproduction repo in CodeSandBox
Why is it closing
DialogPanel1
automatically? I want to ensure thatDialogPanel1
is closed only when I click the close button inDialogPanel1.vue
not for any click onDialogPanel2
. I tried adding the@click.stop
or@mousedown.stop
to prevent the propagation of the event but it's still not working. Can anyone please let me know the issue?Following is my complete code
/pages/index.vue
:Following are my components
/component/DialogPanel1.vue
:Following is my
/components/DialogPanel2.vue
:Why clicking anywhere on
DialogPanel2.vue
automatically closes the previous DialogDialogPanel1.vue
? I tried removing the@close="closeModal"
from theDialogPanel1.vue
that would prevent the closing of theDialogPanel1.vue
but Its also making that I am unable to edit any of the fields inDialogPanel2.vue
meaning the focus kind of still remains on theDialogPanel1.vue
due to which I am unable to get the access or focus inDialogPanel2.vue
. Following changes toDialogPanel1.vue
:<TransitionRoot appear :show="modal1" as="template">
but after this when I am unable to access the Input fields inDialogPanel2.vue
.Issue: Codesandbox
Following issue my issue GIF:
Beta Was this translation helpful? Give feedback.
All reactions