Skip to content

Fix timeline nav scroll-to-top on current timeline#2133

Merged
SnowCait merged 1 commit into
SnowCait:mainfrom
lkjsxc:fix-home-nav-scroll-top
May 24, 2026
Merged

Fix timeline nav scroll-to-top on current timeline#2133
SnowCait merged 1 commit into
SnowCait:mainfrom
lkjsxc:fix-home-nav-scroll-top

Conversation

@lkjsxc
Copy link
Copy Markdown
Contributor

@lkjsxc lkjsxc commented May 24, 2026

Summary

  • Reuse the existing Timeline scroll-to-top behavior when the current timeline nav item is clicked again.
  • Support same-route clicks for Home and Public timelines.
  • Target scroll-to-top requests by timeline route so unrelated mounted timelines do not respond.
  • Keep normal navigation for other routes and modified clicks.

Test plan

  • npm run lint
  • npm test
  • npm run check (fails on existing unrelated diagnostics in Restriction.ts, Gdpr.svelte, and channels/[nevent=note]/+page.svelte)

@lkjsxc lkjsxc force-pushed the fix-home-nav-scroll-top branch 3 times, most recently from 2ff9302 to f9e8938 Compare May 24, 2026 10:30
@lkjsxc lkjsxc changed the title Fix Home nav scroll-to-top on current timeline Fix timeline nav scroll-to-top on current timeline May 24, 2026
@lkjsxc lkjsxc force-pushed the fix-home-nav-scroll-top branch from f9e8938 to 16e1644 Compare May 24, 2026 10:45
@lkjsxc lkjsxc marked this pull request as ready for review May 24, 2026 10:55
@lkjsxc lkjsxc requested a review from SnowCait as a code owner May 24, 2026 10:55
Copilot AI review requested due to automatic review settings May 24, 2026 10:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the app header’s Home/Public navigation so that clicking the currently-active timeline link triggers the existing Timeline “scroll to top” behavior (instead of re-navigating), while keeping normal navigation behavior for other routes and modified clicks.

Changes:

  • Add a route-targeted scroll-to-top request mechanism via a window CustomEvent.
  • Intercept same-route clicks on Home/Public header links to dispatch a targeted scroll-to-top request.
  • Wire Timeline instances on /home and /public to listen for scroll-to-top requests for their own route only.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
web/src/routes/(app)/public/+page.svelte Passes scrollToTopTarget="/public" to the public timeline so it can respond only to relevant scroll-to-top requests.
web/src/routes/(app)/home/+page.svelte Passes scrollToTopTarget="/home" to the home timeline so it can respond only to relevant scroll-to-top requests.
web/src/routes/(app)/Header.svelte Adds same-route click handling for Home/Public to dispatch a targeted scroll-to-top request while preserving normal navigation otherwise.
web/src/lib/timelines/ScrollToTop.ts Introduces a small event-based API to request and subscribe to timeline scroll-to-top actions by target key.
web/src/lib/components/Timeline.svelte Adds an optional scrollToTopTarget prop and registers a scroll-to-top listener on mount to call the existing scrollToTop() behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Owner

@SnowCait SnowCait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@SnowCait SnowCait enabled auto-merge May 24, 2026 14:21
@SnowCait SnowCait merged commit 695ea85 into SnowCait:main May 24, 2026
7 of 8 checks passed
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.

3 participants