fix: use window scroll API for cross-browser compatibility (Safari)

This commit is contained in:
Julien Calixte
2026-02-19 19:03:06 +01:00
parent bb06274c41
commit 4a06c11b0a

View File

@@ -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(() => {