-
-
Notifications
You must be signed in to change notification settings - Fork 12
Usage inside modal not working #85
Comments
WIll check what is going on, can you add a snippet of which props you are using? |
Thank you for your response. You can find my whole modal code including the datepicker below.
|
Investigated a little, this is not an issue from the date picker side. The dialog itself focuses first focusable element, causing conflict within a component since the date picker has a prop open on focus. To be able to open the menu I had to add the Also, noticed some strange behavior, when I click on the component from the dialog, it does a multi-click, which is very odd. I guess they do some custom click handling in the Dialog component. This is happening only when I don't specify Also when the menu is opened with a portal, causes the dialog to close whenever the menu is clicked. This is happening if you connect the |
Thank you for your support! |
Included in the v2.5.0 |
@rinaldihtb What version of the component are you using? |
@Jasenkoo , thanks for your response, for datepicker, i'm using the latest one. and for CoreUI i'm using 4.1 version |
Hello Guys, Recently I'm using this template https://github.com/uilibrary/AatroX-vue. The same problem as @flowbru |
TLDR: Use -- @lgazoni @rinaldihtb We recently encountered this error using Tailwind UI Dialog/Modal wherein the datepicker automatically closes upon any interaction. We found out that this happens since To solve, we used the See example below: <template>
<Dialog :open="isOpen" @close="setIsOpen">
<DialogOverlay />
<DialogTitle>Deactivate account</DialogTitle>
<DialogDescription>
This will permanently deactivate your account
</DialogDescription>
<p>
Are you sure you want to deactivate your account? All of your data will be
permanently removed. This action cannot be undone.
</p>
<div class="mt-2">
<!-- Set teleport attribute here! -->
<Datepicker
teleport="'#datePickerContainerId" <----------------- this <------------------
inputClassName="rounded-lg font--h5"
/>
</div>
<!-- Provide div for teleport WITHIN the modal -->
<div id="datePickerContainerId"></div>
<button @click="setIsOpen(false)">Deactivate</button>
<button @click="setIsOpen(false)">Cancel</button>
</Dialog>
</template>
<script>
import { ref } from "vue";
import {
Dialog,
DialogOverlay,
DialogTitle,
DialogDescription,
} from "@headlessui/vue";
import Datepicker from "vue3-date-time-picker";
import "vue3-date-time-picker/dist/main.css";
export default {
components: { Dialog, DialogOverlay, DialogTitle, DialogDescription, Datepicker },
setup() {
let isOpen = ref(true);
return {
isOpen,
setIsOpen(value) {
isOpen.value = value;
},
};
},
};
</script> |
@Jasenkoo We might need to include this in the package documentation. How do we go about this? I can submit a PR, just let me know 👍 |
@johndalangin @lgazoni @rinaldihtb
This is partially due to dialog, also, if you are using some form of components, most of them rely on click-outside directive from vueuse library which has an event listener on
Also, this solution works fine, that is the way the teleport target is provided. If it is rendered without teleport, it may cause some issues with relative parents.
For now, I have the docs in a separate repo, I might move to the main in the near future. Where would you like to add it? Under teleport or somewhere on top?
I will take a deeper look at what is happening here.
Are you using pure CSS or with some component framework? |
Hello @johndalangin , Thank you so much. See my example below:
|
@johndalangin I have another issue following the teleport example posted. Every time styles of transform, left and top are added into the teleport causing it datepicker to be rendered offscreen. The id given is modified based on the id of the teleport. |
Hi @lgazoni kindly check your syntax you may have an unnecessary
Sorry about that, that's my bad. @jadpdm Could you provide a |
Hi there,
thanks alot for your awesome datepicker!
I just tried to use it inside a modal (tailwindui) and the input field is displayed correctly. However when I click on the input field, the date picker menu is not being opened.
When I embed the datepicker the exact same way on the normal page, it works as expected.
What am I missing here?
The text was updated successfully, but these errors were encountered: