refactor(scroll): delegate note scroll to scrollIntoView

Native scrollIntoView reads the element position at scroll time and
picks the right scrollable ancestor itself, sidestepping iOS Safari
quirks with scrollTo on overflow containers and visual-viewport shifts.
This commit is contained in:
Julien Calixte
2026-05-04 18:29:05 +02:00
parent be006f08b4
commit cc266eac7c

View File

@@ -41,15 +41,8 @@ export const useOverlay = (listen = true) => {
}
const scrollToElement = (element: HTMLElement) => {
const mainApp = document.getElementById("main-app")
if (!mainApp) return
requestAnimationFrame(() => {
const top =
element.getBoundingClientRect().top -
mainApp.getBoundingClientRect().top +
mainApp.scrollTop
mainApp.scrollTo({ top, behavior: "smooth" })
element.scrollIntoView({ behavior: "smooth", block: "start" })
})
}