Skip to content

Commit

Permalink
fix(drop-down-menu): fix strange click behavior in firefox and webkit
Browse files Browse the repository at this point in the history
Seems to be related to blur handler in this component
  • Loading branch information
stfsy committed Apr 15, 2023
1 parent 6c66572 commit c6b07b5
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/components/drop-down-menu.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<Transition name="modal">
<div v-if="isVisible" @mouseenter="onFocus" @mouseleave="onBlur"
<div v-if="isVisible"
class="dsq-drop-down-menu bg-gray-50 text-gray-900 fixed shadow-md font-normal rounded-md w-48 border-2 border-gray-200 duration-200 ease-in-out transition">
<ul class="text-left text-lg">
<slot />
Expand All @@ -10,7 +10,7 @@
</template>

<script setup lang="ts">
import { computed, ref } from 'vue';
import { computed } from 'vue';
const props = defineProps({
show: {
Expand All @@ -19,16 +19,8 @@ const props = defineProps({
}
})
const hasFocus = ref(false)
const isVisible = computed(() => hasFocus.value || props.show)
const isVisible = computed(() => props.show)
function onFocus() {
hasFocus.value = true
}
function onBlur() {
hasFocus.value = false
}
</script>

<style scoped>
Expand Down

0 comments on commit c6b07b5

Please sign in to comment.