Skip to content

feat(desktop): restore a resizable sidebar that collapses below 160px - #611

Merged
vastsa merged 1 commit into
mainfrom
feat/sidebar-resize-collapse
Sep 18, 2026
Merged

vastsa merged 1 commit into
mainfrom
feat/sidebar-resize-collapse

Conversation

@vastsa

@vastsa vastsa commented Sep 18, 2026

Copy link
Copy Markdown
Owner

Why

ADR 0141 made the expanded sidebar a persisted 240..520px column, then D408 /
ADR 0238 pinned it at 275px and hid the handle so the three-column budget could
treat the left dock as a constant. The inspection and space-reclaiming need ADR
0141 recorded is still real, and the live budget can cap a user-chosen width
without freezing it. Dragging past a usable minimum should fold the column
instead of leaving a cramped strip.

What changed

  • The right-edge handle returns on every platform. Pointer motion previews a
    width anchored at the press position; release persists it. ArrowLeft/ArrowRight
    step 16px, Home/End select the live bounds, and keyboard changes commit
    immediately. Escape, cancellation, lost capture, and unmount restore the
    press-time width. Pressing the handle never resizes the column.
  • A pointer width below 160px collapses the sidebar immediately as a user
    action. The collapse keeps the previewed width for the exit animation,
    persists nothing, and reopens at the last committed preferred width, so a
    collapsing drag never overwrites the user's column. Keyboard resize never
    collapses; Cmd/Ctrl+B remains the keyboard fold.
  • The live maximum is the three-column remainder after MainChat's 450px floor
    and an occupying work panel's requested width, so a user-chosen sidebar width
    cannot trip D408's yield. Work-panel growth and window shrink still collapse
    the expanded sidebar at that threshold, and a manual reopen still spends
    work-panel width first.
  • Renderer only: the existing pi.desktop.sidebarWidth preference. No IPC,
    native window bounds, host protocol, or storage-schema change.

New: apps/desktop/src/lib/sidebar-resize.ts (clamp/collapse math and the live
budget), apps/desktop/test/sidebar-resize-math.test.mjs, ADR 0290 with decision
log entry D451, plus the spec, E2E-168, and three-column layout check updates.

Validation

  • pnpm lint (biome + style-token check) — pass
  • pnpm --filter @pi-desktop/desktop typecheck — pass
  • pnpm build:js — pass
  • pnpm -r --if-present test — pass (desktop: 2212 tests)
  • node scripts/check-architecture.mjs against the PR base — pass

Rendered desktop drag/relaunch journey (E2E-168) is still documented as pending,
as it needs a native window; unit and source-contract coverage is in place.

ADR 0141's right-edge handle returns to the expanded sidebar: pointer motion
previews a 240..520px width anchored at the press position, release persists
the preferred width, and ArrowLeft/ArrowRight (16px), Home, and End resize from
the keyboard. Escape, cancellation, lost capture, and unmount restore the
press-time width. The handle is visible again on every platform.

Dragging below 160px now collapses the sidebar immediately instead of leaving
a cramped column. The collapse keeps the previewed width for the exit
animation, persists nothing, and reopens at the last committed preferred width,
so a collapsing drag never overwrites the user's column.

The live maximum is the three-column remainder after MainChat's 450px floor and
an occupying work panel's requested width, so a user-chosen sidebar width
cannot trip D408's sidebar yield. Work-panel growth and window shrink still
collapse the expanded sidebar at that threshold, and a manual reopen still
spends work-panel width first.

Renderer only: the existing pi.desktop.sidebarWidth preference, no IPC, native
window, or storage-schema change. See ADR 0290, D451, and E2E-168.
Copilot AI lite review requested due to automatic review settings September 18, 2026 17:40

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@vastsa
vastsa merged commit 0854ae0 into main Sep 18, 2026
4 checks passed
@vastsa
vastsa deleted the feat/sidebar-resize-collapse branch September 21, 2026 11:16

This branch was successfully deployed

1 active deployment
Preview — 168d893f Deployed Sep 18, 2026 by vercel[bot]
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.

2 participants