Skip to content

Commit

Permalink
fix(kpop): flip
Browse files Browse the repository at this point in the history
  • Loading branch information
Leopoldthecoder committed Jun 14, 2024
1 parent 262516f commit 901d3f4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/KPop/KPop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<div
v-show="isVisible"
:id="popoverId"
:key="popoverKey"
ref="popoverElement"
:aria-labelledby="$slots.title || title ? titleId : undefined"
class="popover"
Expand Down Expand Up @@ -83,7 +84,7 @@
</template>

<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount, computed, watch } from 'vue'
import { ref, onMounted, onBeforeUnmount, computed, watch, nextTick } from 'vue'
import type { PropType } from 'vue'
import { useFloating, autoUpdate, autoPlacement, flip, shift, size } from '@floating-ui/vue'
import type { PopPlacements, PopTrigger } from '@/types'
Expand Down Expand Up @@ -168,6 +169,7 @@ const kPopoverElement = ref<HTMLElement | null>(null)
const triggerWrapperElement = ref<HTMLElement | null>(null)
const popoverElement = ref<HTMLElement | null>(null)
const isVisible = ref<boolean>(false)
const popoverKey = ref(0)
const popoverTrigger = computed((): HTMLElement | null => triggerWrapperElement.value && triggerWrapperElement.value?.children[0] ? triggerWrapperElement.value?.children[0] as HTMLElement : null)
Expand All @@ -181,13 +183,15 @@ const togglePopover = () => {
}
}
const showPopover = () => {
const showPopover = async () => {
if (!props.disabled) {
if (timer.value) {
clearTimeout(timer.value)
}
isVisible.value = true
await nextTick()
popoverKey.value++
}
}
Expand Down

0 comments on commit 901d3f4

Please sign in to comment.