Skip to content

Commit 128b0cf

Browse files
committed
fix: Popover positioning and overflow bugs on mobile
- Use requestAnimationFrame in onMounted so dimensions are read after layout - Fix close() removing wrong CSS property (overflow-y → overflow) - Fix watch handler that returned function ref instead of calling it
1 parent 0210db8 commit 128b0cf

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/components/molecules/popover/Popover.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const props = withDefaults(defineProps<PopoverProps>(), {
6565
const emit = defineEmits(["close", "unmounted"]);
6666
6767
onMounted(() => {
68-
calculatePopoverPosition();
68+
requestAnimationFrame(calculatePopoverPosition);
6969
window.addEventListener("scroll", calculatePopoverPosition);
7070
document.addEventListener("keyup", escapeClicked);
7171
window.addEventListener("popstate", backButtonClicked);
@@ -163,7 +163,7 @@ const calculatePopoverPosition = () => {
163163
};
164164
165165
const close = () => {
166-
document.body.style.removeProperty("overflow-y");
166+
document.body.style.removeProperty("overflow");
167167
emit("close");
168168
};
169169
@@ -184,6 +184,6 @@ const handleClickOutside = (event: MouseEvent) => {
184184
185185
watch(
186186
() => [props.parent, props.position],
187-
() => calculatePopoverPosition
187+
() => calculatePopoverPosition()
188188
);
189189
</script>

0 commit comments

Comments
 (0)