Skip to content

feat(sidebar): hover-peek collapsed nav with drag-to-close#3361

Merged
trunk-io[bot] merged 2 commits into
mainfrom
nav-bar-collapse-peek
Jul 11, 2026
Merged

feat(sidebar): hover-peek collapsed nav with drag-to-close#3361
trunk-io[bot] merged 2 commits into
mainfrom
nav-bar-collapse-peek

Conversation

@adamleithp

@adamleithp adamleithp commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Problems

  • Lost collapse nav button, shortcut-only (cmd b)
2026-07-11 00 31 19

Changes

  • Hover-peek: when the nav is collapsed, hovering an invisible gutter on the window's left edge (or the title-bar toggle) slides the nav out as a floating overlay over the content with a subtle dimming scrim; mouse off and it slides back. The floating panel is resizable too.
  • Drag-to-close: dragging the resize handle clamps at min width, but pulling past half the min width collapses the sidebar; keep holding and drag back out and it pops open again (16px hysteresis so the boundary can't jitter). Works on both the docked and floating panel. The pre-drag width is restored on close so reopening comes back at your chosen size.
  • Synced animation: the container width (incl. min/max-width, which otherwise clamp and jump-cut), the panel translateX, and the title bar all animate on one shared 200ms curve so the content edge and nav edge track each other frame-for-frame in both directions.
  • The title-bar button now toggles collapse (was history-back, duplicating the button next to it), with the icon reflecting state.
  • Resize polish: the handle's primary line stays lit while grabbing, a full-screen shield keeps the col-resize cursor during drags, and the handle disarms briefly during slides so it can't pick up a stale :hover.
  • Collapsed content pane drops its top-left border radius (flush with the window edge).
  • Unmount mid-drag resets body cursor/user-select and the isResizing flag.

How did you test this?

  • pnpm --filter @posthog/ui typecheck and biome clean.
  • Manual in the dev app: peek in/out via gutter and button, drag-to-close/reopen from docked and floating states, resize while floating, scrim fade, animation sync when toggling open/closed (verified scrim styles via CDP against the running app — the radix Tailwind preset has no bg-black/*, hence the bg-blackA-* scale).
  • Verified the other ResizableSidebar consumers (right-side panels: skills, marketplace, canvas, new-task context) are unaffected: all sit inside overflow-hidden ancestors and none use peek.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

🤖 Generated with Claude Code

When the nav is collapsed, hovering the window's left edge or the
title-bar toggle slides it out as a floating overlay with a dimming
scrim; mouse off and it slides away. The resize handle works on the
floating panel too, and dragging past half the min width collapses the
sidebar Linear-style — keep holding and drag back out to pop it open.
Open/close animates the container and panel on one shared curve so the
content edge and nav edge track each other, and the toggle button now
toggles collapse instead of history-back.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Jul 10, 2026

Copy link
Copy Markdown

😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details.

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

React Doctor found 6 issues in 1 file · 6 warnings.

6 warnings

src/primitives/ResizableSidebar.tsx

Reviewed by React Doctor for commit 192c8ac.

@adamleithp adamleithp added Stamphog This will request an autostamp by stamphog on small changes trunk-merge-queue-submit Adding this label to a pull request enqueues it, and removing this label dequeues it labels Jul 10, 2026
@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "feat(sidebar): hover-peek collapsed nav ..." | Re-trigger Greptile

Comment thread packages/ui/src/primitives/ResizableSidebar.tsx Outdated
Comment thread packages/ui/src/features/canvas/components/ChannelsSidebar.tsx

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Complex feature with zero reviews that changes a shared primitive (ResizableSidebar) in ways that affect ~8 existing consumers beyond the intended ChannelsSidebar — specifically removing overflow:hidden and changing the closed state from an in-flow clipped element to an off-screen absolutely-positioned z-50 layer. Get a team review to verify no layout regressions in the other sidebar consumers before merging.

@stamphog stamphog Bot removed the Stamphog This will request an autostamp by stamphog on small changes label Jul 10, 2026
…, arm state inline

Track drag-ended-closed in a ref set synchronously with the closing
mousemove (mouseup can beat React's listener re-registration), cancel
peek when the sidebar unmounts so the module singleton can't leak a
stale overlay into the next mount, and disarm the resize handle inline
during render instead of a prop-watching effect (react-doctor
no-adjust-state-on-prop-change).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@trunk-io trunk-io Bot merged commit eea5948 into main Jul 11, 2026
26 checks passed
@trunk-io trunk-io Bot deleted the nav-bar-collapse-peek branch July 11, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

trunk-merge-queue-submit Adding this label to a pull request enqueues it, and removing this label dequeues it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants