fix chromium

This commit is contained in:
Henry Jameson 2026-09-10 17:15:36 +03:00
commit e53222d632

View file

@ -29,9 +29,7 @@ export function useScrollPosition() {
const scrollIntoView = async (element, options) => { const scrollIntoView = async (element, options) => {
if (element == null) throw new TypeError(`Element is ${element}!`) if (element == null) throw new TypeError(`Element is ${element}!`)
inProgress.value = true inProgress.value = true
let call = element.scrollIntoViewIfNeeded if (!element.scrollIntoViewIfNeeded) {
if (!call) {
call = (options) => {
const { height: windowHeight } = useWindowSize() const { height: windowHeight } = useWindowSize()
const { top, height } = element.getBoundingClientRect() const { top, height } = element.getBoundingClientRect()
const bottom = top + height const bottom = top + height
@ -40,11 +38,10 @@ export function useScrollPosition() {
const aboveTop = top < 0 const aboveTop = top < 0
const belowBottom = bottom > windowHeight.value const belowBottom = bottom > windowHeight.value
if (aboveTop || belowBottom || biggerThanScreen) { if (aboveTop || belowBottom || biggerThanScreen) {
element.scrollIntoView(options) await element.scrollIntoView(options)
} }
} }
} await element.scrollIntoViewIfNeeded(options)
await call(options)
inProgress.value = false inProgress.value = false
} }