Repository navigation
Conversation
The list reset to the top on the way back from a proposal and then animated a scroll to the proposals heading. Now the main element keeps one scroll position per history entry, "Back to proposals" moves back in history when the list is the previous entry, and the voting page only animates on a user toggle.
|
✅ No security or compliance issues detected. Reviewed everything up to 20b53c8. Security OverviewDetected Code Changes
|
📊 Build Bundle StatsThe latest build generated the following assets: |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Delayed list content can prevent restoration, and modified back-link clicks incorrectly navigate the current tab.
2 open issues
What changed in this PR
Preserves the voting list’s scroll position when returning from proposal details.
Changes:
- Replaces scroll resets with history-entry restoration and unit tests.
- Uses history navigation for proposals opened from the list.
- Limits automatic scrolling to list visibility or filter changes.
| File | Description |
|---|---|
| src/governance-app-frontend/src/routes/_auth/voting/proposals/$id/index.tsx | Adds history-aware back navigation. |
| src/governance-app-frontend/src/routes/_auth/voting/index.tsx | Marks list links and avoids scrolling on mount. |
| src/governance-app-frontend/src/routes/_auth.tsx | Enables the restoration hook. |
| src/governance-app-frontend/src/common/utils/initializer.ts | Types the list-origin history flag. |
| src/governance-app-frontend/src/common/hooks/useScrollRestoration.ts | Saves and restores scroll offsets. |
| src/governance-app-frontend/src/common/hooks/useScrollRestoration.test.tsx | Tests navigation and restoration behavior. |
| src/governance-app-frontend/src/common/hooks/useScrollResetOnNavigation.ts | Removes the reset-only hook. |
Review effort: Balanced
…back link If the list cache expired while the user read a proposal, the restore ran against the loading skeleton and the browser clamped it. The restore now retries as the content grows, until the position fits, the user scrolls, or five seconds pass. A modified click on "Back to proposals" follows the link as usual.
Collaborator
Author
|
Checked in the browser against mainnet. Back from a proposal restores the list position in the same frame as the page swap. With the list cache removed, the restore first clamps to the skeleton and lands at the saved position once the list loads. A modified click on "Back to proposals" opens a new tab. |
…sition Loading content can shrink and clamp the position again, so a changed position is no sign of the user. The retry now stops on wheel, touch, key, or pointer input instead.
Collaborator
Author
|
Superseded by #525. |
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
Going back from a proposal to the list looked odd. The list reset to the top, and 300 ms later it animated a scroll to the proposals heading. The proposal the user had opened was no longer on screen, so they had to scroll to find their place again.
Changes
useScrollResetOnNavigationwithuseScrollRestoration, which keeps one scroll position of the main element per history entry and restores it on a history move back or forward.fromProposalListhistory state flag on the list links for that check. A deep link or the command palette still pushes a new list entry at the top.