From 4a06c11b0aa42e5410e1f9144f0e3f0a20d5fd47 Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Thu, 19 Feb 2026 19:03:06 +0100 Subject: [PATCH] fix: use window scroll API for cross-browser compatibility (Safari) --- src/hooks/useOverlay.hook.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/hooks/useOverlay.hook.ts b/src/hooks/useOverlay.hook.ts index c870990..ba5461a 100644 --- a/src/hooks/useOverlay.hook.ts +++ b/src/hooks/useOverlay.hook.ts @@ -4,7 +4,6 @@ import { computed, ref } from 'vue' import { MOBILE_BREAKPOINT } from '@/constants/mobile' export const useOverlay = (listen = true) => { - const body = document.body const x = ref(0) const y = ref(0) const { width } = useWindowSize() @@ -12,12 +11,11 @@ export const useOverlay = (listen = true) => { if (listen) { useEventListener( - body, + window, 'scroll', - (event) => { - const target = event.target as HTMLElement - x.value = target.scrollLeft - y.value = target.scrollTop + () => { + x.value = window.scrollX + y.value = window.scrollY }, { passive: true, @@ -36,7 +34,7 @@ export const useOverlay = (listen = true) => { left: to } - body.scroll(scrollOptions) + window.scrollTo(scrollOptions) } setTimeout(() => {