mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-26 22:43:06 -04:00
(search) clicking / tapping outside of the dialogue closes it
This commit is contained in:
parent
9318d64e44
commit
14937616fe
@ -50,6 +50,16 @@ onUnmounted(() => {
|
||||
document.removeEventListener('keydown', onKeydown);
|
||||
});
|
||||
|
||||
const onMousedown = (event: MouseEvent) => {
|
||||
const rect = dialogue.value?.getBoundingClientRect();
|
||||
if (rect && (
|
||||
event.clientX < rect.left || event.clientX > rect.right ||
|
||||
event.clientY < rect.top || event.clientY > rect.bottom)
|
||||
) {
|
||||
close();
|
||||
}
|
||||
};
|
||||
|
||||
const router = useRouter();
|
||||
watch(router.currentRoute, () => {
|
||||
close();
|
||||
@ -59,7 +69,7 @@ defineExpose({ open, close });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<dialog ref="dialogue" class="container m-auto h-100 rounded border">
|
||||
<dialog ref="dialogue" class="container m-auto h-100 rounded border" @mousedown="onMousedown">
|
||||
<div class="input-group mb-4">
|
||||
<span class="input-group-text">
|
||||
<Spinner v-if="isLoading" size="1.25em" />
|
||||
|
Loading…
x
Reference in New Issue
Block a user