Skip to content

Commit 1c1dcdd

Browse files
committed
fix: overlay close not working
1 parent 05e9a00 commit 1c1dcdd

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

web/components/Modal.vue

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { computed, watchEffect } from 'vue';
2+
import { computed, watchEffect, ref, onMounted, onBeforeUnmount } from 'vue';
33
44
import { XMarkIcon } from '@heroicons/vue/24/outline';
55
import { cn } from '@unraid/ui';
@@ -70,6 +70,22 @@ const computedVerticalCenter = computed<string>(() => {
7070
}
7171
return props.modalVerticalCenter ? 'justify-center' : 'justify-start';
7272
});
73+
74+
const modalContentRef = ref<HTMLElement | null>(null);
75+
76+
onMounted(() => {
77+
const handleClick = (event: MouseEvent) => {
78+
if (!props.open || props.disableOverlayClose) return;
79+
const target = event.target as Node;
80+
if (modalContentRef.value && !modalContentRef.value.contains(target)) {
81+
closeModal();
82+
}
83+
};
84+
document.addEventListener('mousedown', handleClick);
85+
onBeforeUnmount(() => {
86+
document.removeEventListener('mousedown', handleClick);
87+
});
88+
});
7389
</script>
7490

7591
<template>
@@ -112,6 +128,7 @@ const computedVerticalCenter = computed<string>(() => {
112128
class="w-full"
113129
>
114130
<div
131+
ref="modalContentRef"
115132
:class="[
116133
maxWidth,
117134
disableShadow ? 'shadow-none border-none' : 'shadow-xl',

web/components/UpdateOs/ChangelogModal.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ watch(docsChangelogUrl, (newUrl) => {
104104
:t="t"
105105
:tall-content="true"
106106
:title="parsedChangelogTitle ?? undefined"
107+
:disable-overlay-close="false"
107108
@close="updateOsChangelogStore.setReleaseForUpdate(null)"
108109
>
109110
<template #main>

0 commit comments

Comments
 (0)