feat(notes): scroll to the last stacked note on page load
All checks were successful
CI / verify (push) Successful in 1m5s

Shared links with stackedNotes landed on the readme, forcing readers to
scroll past every note to reach the one that matters — especially long
on mobile where notes stack vertically.
This commit is contained in:
Julien Calixte
2026-07-08 00:30:56 +02:00
parent f9906cba30
commit 049ce01ab5
3 changed files with 25 additions and 5 deletions

View File

@@ -111,6 +111,16 @@ export const useRouteQueryStackedNotes = () => {
})
}
// Focus the deepest note when opening a shared link with stacked notes,
// instead of landing on the readme and forcing a manual scroll (especially
// long on mobile where notes stack vertically).
const scrollToLastStackedNote = () => {
const lastNote = stackedNotes.value.at(-1)
if (lastNote) {
scrollToFocusedNote({ noteId: lastNote })
}
}
const addStackedNote = (
currentSha: string,
sha: string,
@@ -168,6 +178,7 @@ export const useRouteQueryStackedNotes = () => {
stackedNotes: readonly(stackedNotes),
addStackedNote,
replaceStackedNote,
scrollToFocusedNote
scrollToFocusedNote,
scrollToLastStackedNote
}
}