Skip to content

fix(web): keep sidebar scroll position when pinning threads - #10757

Open
saphid wants to merge 1 commit into
pingdotgg:mainfrom
saphid:fix/sidebar-pin-scroll
Open

fix(web): keep sidebar scroll position when pinning threads#10757
saphid wants to merge 1 commit into
pingdotgg:mainfrom
saphid:fix/sidebar-pin-scroll

Conversation

@saphid

@saphid saphid commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

What Changed

Pinning a visible thread partway down the sidebar can jump the entire list to the top. Exclude the sidebar content from browser scroll anchoring so pinning and unpinning preserve the scroll position. The existing row animation and explicit search navigation continue to work.

Why

The unified list introduced in #9731 retains a thread's DOM row while moving it between sections. Browser scroll anchoring can follow that row into Pinned. This is a side effect of the section move, rather than an intentional scroll request. The fix is scoped to the shared sidebar content; transcript scroll behavior is unaffected.

UI Changes

Same disposable Harbor project, 40 threads with fixed active ordering, dark theme, 1280×800 browser viewport, and the same thread/menu action. Base 7220dfe2c; candidate 0e4544cc7. Menu opening uses the real DOM handler, and a normal preview click pins through the real backend.

Before: sidebar scrollTop jumps from 1,000 px to 0 px.

Before: pinning Harbor task 27 jumps the list to Pinned

After: sidebar scrollTop stays at 1,000 px.

After: pinning Harbor task 27 preserves the sidebar scroll position

GIFs crop the sidebar and sample at 20 fps. Only idle lead-in is trimmed; the action and settled result retain their original speed. They illustrate the jump, not animation smoothness. Relative age labels advance between captures.

Before recording · After recording · Annotated before · Annotated after

Before screenshot · After screenshot

Verification

Current head e048caf6c is rebased onto b5d89038a. The documentation conflict preserves upstream file-drop instructions and this scroll-position note. The anchoring fix itself is unchanged. The recordings above retain their original revision labels; the same browser pin scenario was freshly repeated on the rebased head with the new upstream scroll-fade-padding behavior: 1,000 → 1,000 px. Focused tests (21), web typecheck, scoped lint and formatting were repeated after rebase.

  • cd apps/web && vp test run src/components/ui/sidebar.test.tsx src/components/Sidebar.motion.test.ts: 21 tests pass.
  • cd apps/web && vp run typecheck: passes.
  • Scoped lint and formatting pass; lint reports the existing Math.random purity warning in SidebarMenuSkeleton.
  • Full browser client: reproduced the base jump twice; candidate pin preserved 1,000 px, unpin preserved 0 px, ordinary scrolling reached 700 px, and keyboard search advanced to the next result. No running row animations remained after the candidate pin.

The real scroll regression was checked in Chromium; the existing unit tests do not emulate browser scroll anchoring. Electron shares this sidebar but its native shell/context menu was not separately exercised. Grouped sidebar, React Native, and SwiftUI were not independently exercised; no native client code or wire contracts change.

Independent review was attempted with claude -p --model claude-opus-5 --effort high --tools '' --output-format json against the frozen diff and project coding standards. It exited 1 on expired OAuth before any model ran; no independent review occurred. Local review found no actionable issues in the two-file change.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Implemented and verified with GPT-6 in the Codex harness.

Summary by CodeRabbit

  • Bug Fixes

    • Prevented the sidebar from jumping to a different scroll position when threads are pinned or unpinned.
  • Documentation

    • Clarified that pinning or unpinning threads preserves the sidebar’s current scroll position on web and desktop.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Sep 8, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 0e4544c

Macroscope's review found this PR approvable — This is a narrowly scoped sidebar UI bug fix that disables browser scroll anchoring during row reordering, preserving the user’s scroll position without changing application data or APIs. The accompanying documentation-only update has no runtime impact.

You can add or adjust custom eligibility rules. Learn more.

@saphid
saphid force-pushed the fix/sidebar-pin-scroll branch from 0e4544c to e048caf Compare September 8, 2026 12:43
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 26e764f5-5bb4-48bd-8dc9-052bf28330b5

📥 Commits

Reviewing files that changed from the base of the PR and between 061543e and e048caf.

📒 Files selected for processing (2)
  • apps/web/src/components/ui/sidebar.tsx
  • docs/user/thread-sidebar.md

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The sidebar disables browser scroll anchoring when reordered rows change position. Documentation describes the preserved scroll position when pinning or unpinning threads on web and desktop.

Changes

Sidebar scroll behavior

Layer / File(s) Summary
Preserve sidebar position during thread reordering
apps/web/src/components/ui/sidebar.tsx, docs/user/thread-sidebar.md
The sidebar applies [overflow-anchor:none] to its scroll container. The thread sidebar documentation describes the resulting scroll behavior.

Priority: ⬇️ Low — Defer the sidebar scroll-position fix because it is a narrow web usability improvement with no stated broader product or external urgency.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to e048c

Pinning or unpinning threads now preserves the sidebar’s current scroll position, with matching documentation. No current merge-readiness risk remains.

Suggested reviewers: t3dotgg, juliusmarminge

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the primary change: preserving sidebar scroll position when pinning threads.
Description check ✅ Passed The description explains what changed, why the issue occurred, the scope of the fix, UI evidence, verification results, limitations, and checklist completion. It is complete and aligned with the repos…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant