diff --git a/src/ui/components/FaDrawer/index.vue b/src/ui/components/FaDrawer/index.vue index 4727cf6a..cd863987 100644 --- a/src/ui/components/FaDrawer/index.vue +++ b/src/ui/components/FaDrawer/index.vue @@ -73,6 +73,9 @@ const emits = defineEmits<{ 'cancel': [] }>() +const id = useId() +provide('DrawerId', id) + const isOpen = ref(props.modelValue) watch(() => props.modelValue, (newValue) => { @@ -106,14 +109,16 @@ function handleFocusOutside(e: Event) { } function handleClickOutside(e: Event) { - if (!props.closeOnClickOverlay) { + if (!props.closeOnClickOverlay || (e.target as HTMLElement).dataset.drawerId !== id) { e.preventDefault() + e.stopPropagation() } } function handleEscapeKeyDown(e: KeyboardEvent) { if (!props.closeOnPressEscape) { e.preventDefault() + e.stopPropagation() } } @@ -128,12 +133,15 @@ function handleAnimationEnd() {