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

popover doesn't close when clicking in another date-picker #1478

Open
Puplum opened this issue Jun 14, 2024 · 1 comment
Open

popover doesn't close when clicking in another date-picker #1478

Puplum opened this issue Jun 14, 2024 · 1 comment

Comments

@Puplum
Copy link

Puplum commented Jun 14, 2024

I have :

const popover = ref({
  visibility: "click",
});

1/ When I click on a date-picker, the popover opens.
image

2/ If I click on another date-picker, the first one doesn't close.
image

I can open an infinite number of popovers.

@MohamedAmr21
Copy link

I encountered the same issue, so I created a workaround by developing a function that closes all popovers and opens the selected one:

<script setup lang=ts>
const dates = ref([
  {
    key: "popover1",
    selectedDate: "",
    placeholder: "Select Date 1",
    popoverState: false,
  },
  {
    key: "popover2",
    selectedDate: "",
    placeholder: "Select Date 2",
    popoverState: false,
  },
// add more popover as you like
]);

const openPopover = (popoverKey: string) => {
  dates.value.forEach((date) => {
    date.popoverState = date.key === popoverKey;
  });
};
</script>

<template>
<input
  type="text"
  v-model="date.selectedDate"
  @focus="openPopover(date.key)"
/>
</template>

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

2 participants