Fix calculation of targetTop in router.ts

pull/5022/head
Aryaman1792 6 months ago committed by GitHub
parent be260fda6e
commit ac7f16b7c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -269,11 +269,11 @@ export function scrollTo(hash: string, smooth = false, scrollPosition = 0) {
}
if (!target) return
const targetTop =
const targetTop ={
window.scrollY +
target.getBoundingClientRect().top -
getScrollOffset() +
Number.parseInt(window.getComputedStyle(target).paddingTop, 10) || 0
Number.parseInt(window.getComputedStyle(target).paddingTop, 10) }|| 0
const behavior = window.matchMedia('(prefers-reduced-motion)').matches
? 'instant'

Loading…
Cancel
Save