feat: scrolls page to top on sidebar Home click#14936
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a small UX improvement in Ledger Live Desktop’s MVVM layout so that clicking Home in the sidebar while already on the Home route triggers a smooth scroll back to the top of the page scroller.
Changes:
- Introduces a shared
SCROLL_TO_TOP_EVENTconstant for cross-component scroll-to-top coordination. - Dispatches the scroll-to-top event from the sidebar when Home is clicked while already on Home (Wallet 4.0 main nav).
- Listens for the event in the Page view model and scrolls the page scroller to the top.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/ledger-live-desktop/src/mvvm/components/SideBar/useSideBarViewModel.ts | Dispatches a scroll-to-top custom event when Home is clicked while already on Home (Wallet 4.0 main nav). |
| apps/ledger-live-desktop/src/mvvm/components/Page/usePageViewModel.ts | Adds a window event listener that scrolls the page scroller to top when the custom event is received. |
| apps/ledger-live-desktop/src/mvvm/components/Page/constants.ts | Defines the SCROLL_TO_TOP_EVENT string constant. |
| .changeset/late-crabs-prove.md | Declares a Desktop changeset for the new UX behavior. |
apps/ledger-live-desktop/src/mvvm/components/SideBar/useSideBarViewModel.ts
Show resolved
Hide resolved
| value === "home" && | ||
| location.pathname === SIDEBAR_VALUE_TO_PATH.home | ||
| ) { | ||
| window.dispatchEvent(new CustomEvent(SCROLL_TO_TOP_EVENT)); |
There was a problem hiding this comment.
Let's create a function like "handleScrollToTop" to make it more explicit, rather than a window.dispatchEvent wdyt?
| const onClickScrollUp = useCallback(() => scrollToTop(), [scrollToTop]); | ||
|
|
||
| // When sidebar (or elsewhere) dispatches SCROLL_TO_TOP_EVENT, scroll the page scroller to top | ||
| useEffect(() => { |
There was a problem hiding this comment.
useLayoutEffect could be more appropriated no?
1e1474c to
56c4b59
Compare
|
56c4b59 to
80e7400
Compare
apps/ledger-live-desktop/src/mvvm/components/SideBar/useSideBarViewModel.ts
Show resolved
Hide resolved
80e7400 to
6b09011
Compare
|



✅ Checklist
npx changesetwas attached.📝 Description
This pull request introduces a minor feature to improve the user experience in the Ledger Live Desktop app. Now, when a user clicks "Home" in the sidebar while already on the home page, the app will smoothly scroll the page to the top. This is achieved through a custom event and coordinated updates to the sidebar and page view models.
Screen.Recording.2026-03-02.at.16.13.10.mov
❓ Context
LIVE-27082
🧐 Checklist for the PR Reviewers