Skip to content

desktop: float unread indicator + fix sidebar scroll jump#777

Merged
wesbillman merged 2 commits into
mainfrom
unread-float-accent
May 28, 2026
Merged

desktop: float unread indicator + fix sidebar scroll jump#777
wesbillman merged 2 commits into
mainfrom
unread-float-accent

Conversation

@wesbillman

@wesbillman wesbillman commented May 28, 2026

Copy link
Copy Markdown
Collaborator

Changes

Float unread indicator with accent background

  • Remove bordered pill styling from MoreUnreadButton
  • Use bg-primary (accent color) to match the unread dot
  • Position absolutely over channel list so it floats
  • Add position prop (top/bottom) for directional placement

Fix sidebar scroll jump on channel selection

  • TanStack Router's scroll restoration captures all scroll events including the sidebar
  • When navigating between channels, it would restore the sidebar to a stale position
  • Add a useSidebarScrollLock hook that subscribes to the router's event system:
    • onBeforeLoad — snapshots the sidebar's scrollTop before navigation starts
    • onRendered — re-applies the saved position after the router's scroll restoration has already run
  • No race condition: our subscriber runs after the router's built-in scroll restore

Files changed

  • desktop/src/features/sidebar/lib/useSidebarScrollLock.ts (new)
  • desktop/src/features/sidebar/ui/AppSidebar.tsx
  • desktop/src/features/sidebar/ui/MoreUnreadButton.tsx

- Remove bordered pill styling from MoreUnreadButton
- Use bg-primary (accent color) to match the unread dot
- Position absolutely over channel list so it floats
- Add position prop (top/bottom) for directional placement

Signed-off-by: Wes <wesbillman@users.noreply.github.com>
@wesbillman wesbillman requested a review from a team as a code owner May 28, 2026 20:48
TanStack Router's scroll restoration captures all scroll events including
the sidebar. When navigating between channels, it would restore the
sidebar to a stale position. Add a useSidebarScrollLock hook that tracks
the sidebar's scrollTop and re-applies it in a layout effect after
pathname changes, preventing the jump.

Signed-off-by: Wes <wesbillman@users.noreply.github.com>
@wesbillman wesbillman changed the title desktop: float unread indicator with accent background desktop: float unread indicator + fix sidebar scroll jump May 28, 2026
@wesbillman wesbillman merged commit 9db8f6c into main May 28, 2026
15 checks passed
@wesbillman wesbillman deleted the unread-float-accent branch May 28, 2026 22:15
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