Skip to content

feat(sidebar): reset width on double-click with viewport-based default - #6287

Open
chirivelli wants to merge 3 commits into
pingdotgg:mainfrom
chirivelli:sidebar-double-click-to-default-size
Open

feat(sidebar): reset width on double-click with viewport-based default#6287
chirivelli wants to merge 3 commits into
pingdotgg:mainfrom
chirivelli:sidebar-double-click-to-default-size

Conversation

@chirivelli

@chirivelli chirivelli commented Aug 12, 2026

Copy link
Copy Markdown

Double-clicking the resize rail restores the sidebar to 20% of the viewport width and persists the reset preference.

What Changed

Double-clicking the sidebar resize rail resets the width to 20% of the viewport. The reset is saved to localStorage.

Why

There was no quick way to get back to a default width after resizing. Double-click-to-reset is a familiar pattern and keeps the sidebar proportional across window sizes.

UI Changes

Double-click the resize handle between the sidebar and main content to snap the sidebar back to its default width. Video attached.

Screen.Recording.2026-08-12.at.2.05.12.PM.mov

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

Note

Low Risk
UI-only sidebar sizing and localStorage preference changes; no auth, security, or data-handling impact.

Overview
Adds double-click-to-reset on the sidebar resize rail, snapping width back to a viewport-scaled default (~20%) and persisting that preference.

Replaces the fixed THREAD_SIDEBAR_DEFAULT_WIDTH with THREAD_SIDEBAR_DEFAULT_WIDTH_RATIO and resolveThreadSidebarDefaultWidth, so first-load and reset widths scale with the window (still clamped to min/max). AppSidebarLayout passes that live default into the sidebar’s resizable options.

Reviewed by Cursor Bugbot for commit 86b19d6. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Reset sidebar width on double-click using viewport-based default

  • Replaces the fixed THREAD_SIDEBAR_DEFAULT_WIDTH constant with THREAD_SIDEBAR_DEFAULT_WIDTH_RATIO (0.2), so the default sidebar width scales with viewport size and is clamped between min and max bounds.
  • Adds resolveThreadSidebarDefaultWidth(viewportWidth) in threadSidebarWidth.ts to compute this clamped default, and updates resolveInitialThreadSidebarWidth to use it as the fallback when no stored preference exists.
  • Extends SidebarResizableOptions in sidebar.tsx with an optional defaultWidth prop and wires a double-click handler on SidebarRail that resets the sidebar to this default, persists it to localStorage, and calls onResize.
  • Behavioral Change: first load or cleared-preference sidebar width is now viewport-relative (~20%) rather than a fixed pixel value.

Macroscope summarized 86b19d6.

Double-clicking the resize rail restores the sidebar to 20% of the
viewport width and persists the reset preference.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 62aca888-3b2a-444d-bbd5-ada1baabd801

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 12, 2026
Comment thread apps/web/src/components/ui/sidebar.tsx
Wrap setLocalStorageItem in try/catch so onResize still runs when persistence throws.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ad7ec01. Configure here.

Comment thread apps/web/src/components/threadSidebarWidth.test.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved 86b19d6

Self-contained UI enhancement adding double-click reset to sidebar and viewport-based default width. Changes are limited to sidebar components with simple clamped math, include tests, and only affect user-triggered interactions.

You can customize Macroscope's approvability policy. Learn more.

Derive the expected default width from THREAD_SIDEBAR_DEFAULT_WIDTH_RATIO instead of hardcoding 264.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant