Repository navigation
Conversation
Back and Forward now restore the scroll position of the page in `<main>`. The hook saves the position for each history entry. A new entry still starts at the top. If the list data loads late, the restore waits for it. "Back to proposals" now goes back in history when the previous entry is the proposal list. The system Back gesture then does not return to the proposal.
|
✅ No security or compliance issues detected. Reviewed everything up to 019b0c3. Security OverviewDetected Code Changes
|
📊 Build Bundle StatsThe latest build generated the following assets: |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Input cancellation can leave a stale saved position and cause incorrect scrolling on a later return.
1 open issue
What changed in this PR
Restores navigation scroll positions and makes “Back to proposals” return through history when opened from the list.
Changes:
- Saves and restores per-entry scroll positions, including delayed content loading.
- Coordinates proposal navigation with scroll restoration.
- Adds hook tests for restoration and cancellation.
| File | Description |
|---|---|
src/governance-app-frontend/src/routes/_auth/voting/proposals/$id/index.tsx |
Uses history Back for list-origin navigation. |
src/governance-app-frontend/src/routes/_auth/voting/index.tsx |
Marks list-origin links and skips conflicting scrolling. |
src/governance-app-frontend/src/common/utils/initializer.ts |
Types the navigation history marker. |
src/governance-app-frontend/src/common/hooks/useScrollResetOnNavigation.ts |
Implements per-entry scroll restoration. |
src/governance-app-frontend/src/common/hooks/useScrollResetOnNavigation.test.tsx |
Tests restoration, delayed content, and cancellation. |
Review effort: Balanced
Copilot
AI
dismissed their stale review, a newer Copilot review was requested
November 5, 2026 19:24
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A pending smooth-scroll timer can overwrite the restored scroll position after Back navigation, so the timeout must recheck restoresScrollPosition before scrolling.
1 open issue
1 resolved since last review
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Motivation
On Android, Back is the main way back, and two things break it. Back to the proposal list always scrolled
<main>to the top, so users lost their place (Pixel 9 emulator: the list was at 997px, it came back at 481px). "Back to proposals" pushed a new entry, so the system Back gesture after it returned to the proposal.Changes
useScrollResetOnNavigationto save the<main>scroll position for each history entry and restore it on Back and Forward. A new entry still starts at the top./voting.