Skip to content

OXY-155: Page switch resets scroll to top - #293

Open
Kalin-Rudnicki wants to merge 1 commit into
mainfrom
OXY-155
Open

OXY-155: Page switch resets scroll to top#293
Kalin-Rudnicki wants to merge 1 commit into
mainfrom
OXY-155

Conversation

@Kalin-Rudnicki

Copy link
Copy Markdown
Owner

OXY-155 — Page switch lands in the middle of the page

Root cause: PageManager.loadPage only scrolled after a page switch when the URL carried a #fragment. With no fragment it did nothing, so the new page inherited the previous page's scroll position — the reused HolyGrail center pane (.oxy-holy-grail-center, overflow-y:auto) keeps its scrollTop, landing the new page mid-page.

Fix:

  • New PageScroll service: pure targetFor(fragment)Top | Fragment(id), plus onNavigate that either scrolls to top or to the anchor.
  • New Window.scroll.toTop — resets the document/window scroll and the reused center scroll containers (.oxy-holy-grail-center / --center-only).
  • PageManager.loadPage now calls PageScroll.onNavigate(fragment); anchor/hash navigation behavior is unchanged.
  • Added PageScroll pure-logic tests.

Verification: sbt oxygen-ui-web/test → 47 tests pass (incl. new suite), clean compile under -Werror.

Confidence: 8/10. High confidence on the root cause and the standard navigation path (HolyGrail + document scroll). Not higher because the JS test env has no DOM (couldn't visually confirm in a browser) and bespoke non-HolyGrail scroll containers are covered only by the window reset. See report/OXY-155.md for full details, decisions, and assumptions.

🤖 Generated with Claude Code

Client-side navigation only scrolled when the URL had a #fragment, so a page
switch inherited the previous page's scroll position (the reused HolyGrail
center pane keeps its scrollTop) and landed mid-page.

- add PageScroll service: targetFor(fragment) -> Top | Fragment(id), plus
  onNavigate that scrolls to top (window + center scroll containers) or to
  the anchor.
- add Window.scroll.toTop resetting document scroll and
  .oxy-holy-grail-center / --center-only containers.
- PageManager.loadPage now calls PageScroll.onNavigate (anchor behavior kept).
- add PageScroll pure-logic tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant