-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Description
The Problem
Reproduction
- Open https://lodash.com/docs/4.17.21#concat in a new tab - scrolls to anchor ✅
- Refresh the page - scrolls to top instead of anchor ❌
Theory
The docs layout uses a nested scroll container (.doc-container has overflow-y: auto). The document itself doesn't scroll - scrolling happens inside that container.
On fresh page load, browsers seem smart enough to scroll nested containers to bring anchors into view. On reload, scroll restoration kicks in and restores the document scroll position (always 0), which seems to override hash navigation. The nested container's scroll position isn't restored.
Console check:
console.log('document scrollY:', window.scrollY) // always 0
console.log('doc-container scrollTop:', document.querySelector('.doc-container').scrollTop)Related
- Anchor tags are not working in Chrome on first load #243 (which doesnt repro anymore)
Metadata
Metadata
Assignees
Labels
No labels