Repository navigation
Make sidebar resizing follow the pointer - #46
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Scott · project thread
Summary
Dragging the sidebar edge lagged behind the pointer. There were three causes:
widthtransition 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.pointermovecalledsetPreferredSidebarWidthon the rootApp, which re-rendered the whole shell, including heavy dashboards and conversations.Fix:
ResizeHandletakes optionalonDragStartandonDragcallbacks. It coalesces pointer moves to one per animation frame and callsonResizeonce when the drag ends (pointer up or lost capture). Keyboard resizing is unchanged.Appwrites--sidebar-widthstraight 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:
4 11 18 24 31 39 46 53 60 65 57 48 …px behind0 0 0 0 …(the edge stays under the pointer)pnpm lintandtypecheckare clean.🤖 Generated with Claude Code