Commit Graph
3 Commits
Author SHA1 Message Date
bbassieandClaude Opus 5.5 e1ffb848b1 Define fake DOM globals as non-enumerable in tests
mocha --check-leaks flagged window, document and ResizeObserver set by
the scroll restoration tests. Define them with defineProperty and restore
the original descriptors afterwards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 02:54:18 +00:00
bbassieandClaude Opus 5.5 628e59bf2c Move scroll restoration logic out of the hook for testing
The effects now call a ScrollRestorer class and restoreScroll is exported,
so the tests can drive both against a fake window, sessionStorage and
ResizeObserver. The hook is three lines that wire them to the router.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 02:50:12 +00:00
bbassieandClaude Opus 5.5 33817bbe42 Remember scroll position on back/forward and reload
BrowserRouter has no scroll handling and the browser's own restoration
runs before the page has loaded its data, so it lands short. Track the
window scroll per history entry in sessionStorage and restore it on POP,
retrying as the page grows until it fits, the user scrolls or 5 s pass.
Pushing a new pathname scrolls to the top; query-only pushes (table sort,
filter, page) keep the position.

Closes #1247

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 02:43:57 +00:00