Skip to content

Make sidebar resizing follow the pointer - #46

Merged
srctl merged 1 commit into
mainfrom
claude/sidebar-resize-lag
Nov 19, 2026
Merged

srctl merged 1 commit into
mainfrom
claude/sidebar-resize-lag

Conversation

@srctl

@srctl srctl commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Requested by Scott · project thread

Summary

Dragging the sidebar edge lagged behind the pointer. There were three causes:

  1. Width transition during drag. The desktop navigation pane has a 320ms width transition so it can animate when it collapses. That transition also ran on every drag update, so the edge was always easing toward an old target.
  2. App-wide re-render per pointer move. Each pointermove called setPreferredSidebarWidth on the root App, which re-rendered the whole shell, including heavy dashboards and conversations.
  3. Cookie write per pointer move.

Fix:

  • ResizeHandle takes optional onDragStart and onDrag callbacks. It coalesces pointer moves to one per animation frame and calls onResize once when the drag ends (pointer up or lost capture). Keyboard resizing is unchanged.
  • During a drag, App writes --sidebar-width straight onto the pane and turns the transition off. React state and the cookie are updated once, when the drag ends.

Testing

I drove a Playwright drag against the dev server on a dashboard page, moving the pointer 8px every 16ms, and measured how far the pane edge was from the pointer:

  • Before: 4 11 18 24 31 39 46 53 60 65 57 48 … px behind
  • After: 0 0 0 0 … (the edge stays under the pointer)

pnpm lint and typecheck are clean.

🤖 Generated with Claude Code

The sidebar's 320ms width transition (meant for collapsing) also ran
while dragging, so the edge trailed the pointer by up to ~65px. Each
pointer move also re-rendered the whole app and rewrote the cookie.

Disable the transition during a drag, write the width straight to the
pane once per animation frame, and commit state and the cookie when
the drag ends.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@srctl srctl self-assigned this Nov 19, 2026
@srctl
srctl merged commit cfb24e6 into main Nov 19, 2026
2 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.

1 participant