Skip to content

LOCAL: stop a shrunk sidebar leaving a black strip beside the terminal - #66

Merged
kiwidream merged 2 commits into
swaplabs/mainfrom
kiwidream/sidebar-shrink-fill
Oct 28, 2026
Merged

kiwidream merged 2 commits into
swaplabs/mainfrom
kiwidream/sidebar-shrink-fill

Conversation

@kiwidream

@kiwidream kiwidream commented Oct 28, 2026 •

Copy link
Copy Markdown
Files Added Deleted Net
Test 0 0 0 0
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​62 $\color{#cf222e}{\Huge{\mathbf{−}}}$​4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​58

ELI5

Dragging the left sidebar narrower left a black strip between the sidebar and the terminal, and the terminal didn't grow into the space. Now the terminal fills it. When the UI is zoomed far out, the sidebar also stops shrinking before its buttons would overlap.

What Changed

Before: on macOS (and paired-web) chrome, the titlebar header above the sidebar set the left column's width by its full content width. The header holds the traffic-light pad, the fork's long Forca 1.4.214 (SwapLabs/<rev>) app name, the sidebar toggle and the history buttons, which add up to about 436px. Dragging the sidebar below that left the column at 436px: the leftover strip showed the transparent app background (black), and the terminal kept its old width.

4ee7b3b: .titlebar-left:not(.titlebar-left-floating) now has contain: inline-size, so only the sidebar sizes the column. min-w-0 on the control group lets the app name clip before any button.

3d193c9: at UI zoom −2.5 and below, the traffic-light pad (80px / zoom) no longer fit beside the buttons in a 220px sidebar, so the toggle overlapped Go back and ignored clicks. The titlebar's existing ResizeObserver now also measures the header's non-shrinkable width: every control, plus the zoom-scaled pad, minus the app name's text. The sidebar uses max(220, that width) as both its drag minimum and its rendered floor. The stored width is not rewritten, so zooming back in restores it.

Why

Containment is the smallest change that stops header content from sizing the column. The alternatives each fall short:

  • shortening or hiding the label leaves the zoomed-out case broken;
  • an explicit column width would duplicate the sidebar-width state.

Deriving the minimum from the measured controls keeps every button usable at any zoom without letting the header widen the column again.

Linked Issue

N/A: the operator reported it directly. Fork-only (LOCAL:) for now. Upstream has a latent version of the same bug: with the shorter Orca label the gap is 2px at zoom 1 and 14px at zoom −3. Upstreaming is a separate decision.

Visual Proof

Measured in the hidden e2e app (Electron on Linux with a macOS user agent), in dark and light themes. The terminal's column count at sidebar widths 480 → 360 → 280 → 220 (a drag to 150 stops at the 220 minimum):

480 360 280 220
Before (column stuck at 436px) 66 71 71 71
After 66 80 89 97

Before 3d193c9, at UI zoom −2.5 and −3 with the sidebar at its minimum, the toggle overlapped Go back by 11px and 22px. After it:

  • the effective minimum is 241px at −2.5 and 253px at −3, and stays 220px at every other zoom tested;
  • there are no overlaps, and a real click on the toggle collapses the sidebar at every minimum;
  • zoom 0 geometry is identical to 4ee7b3b;
  • Linux and Windows custom chrome are unchanged (minimum 220px at every zoom).

Before/after screenshots exist for every width, zoom and chrome (on minidev-alex1) but are not attached here, because no image-upload tool is available on the VM. I can add them on request.

Testing

  • An e2e repro spec, not committed because it needs a user-agent spoof, covered:

    • widths 480 to 150;
    • zoom −3, −2.5, −1.5, 0 and +2;
    • Mac, Linux and Windows chrome;
    • collapsed/floating mode, full screen, the app name hidden, and the right sidebar open and closed.
  • An independent adversarial verification run confirmed 4ee7b3b and found the zoom-out overlap that 3d193c9 fixes. 3d193c9 was then measured across the same matrix.

  • pnpm check:changed --maxWorkers=2 --base=refs/remotes/swaplabs/swaplabs/main passed (20/20) on both commits.

  • Not tested on a physical Mac; the macOS chrome was exercised through the user-agent spoof.

  • I manually tested these changes locally (hidden Electron renderer on Linux, Mac chrome via user-agent spoof)

  • Automated tests added/updated, or explained why not below: the geometry depends on macOS chrome, which the e2e suite only renders under a user-agent spoof, so no committed test was added.

AI Disclosure

Prepared by Claude Code (Claude Opus 5.5) at the operator's request.

Review

Local /code-review medium before the first push raised 8 candidate findings. None blocks: the measured runs above show no overlap or gap at any tested width, zoom or chrome. Deferred, with reasons:

  • At UI zoom −2.5 and below, the measured minimum includes the history buttons, which mount only in some views. Switching to a view without them lowers the minimum by about 60px, so the sidebar can change width. Below −2.5 only.
  • The ResizeObserver subscribes to the row's grandchildren once per effect run. A remount without a dependency change, followed by a zoom change, could leave the minimum stale. Speculative.
  • Each observer callback now reads styles for about 8 elements, including on every drag frame. The reads run after layout and an unchanged value does not re-render, so the cost is minor. It could short-circuit.
  • Not adopted: deriving the minimum from the zoom factor alone (220 + 80/z − 80). That over-reserves by about 25px and would raise the minimum at moderate zoom-outs, such as −1.5, where it isn't needed.
  • By design: a drag that starts at the raised width saves the dragged width, as any drag does.
  • Not acted on: two speculative cases, the sidebar's error fallback and a few-px margin under-count.

Agent skill upstream boundary

  • Not applicable: renderer layout only; no agent skill.

Notes

  • Security: none affected.
  • Cross-platform: Linux and Windows custom chrome measured unchanged.
  • Remote and SSH: renderer-only.
  • Mobile: has no sidebar.
  • Backward compatibility: the stored sidebar width is never rewritten.
  • Performance: one more element measured by the existing ResizeObserver.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason: measured numbers above; image files available on request
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred): check:changed (format, lint, typecheck, affected tests) passed; the full build is left to CI

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

kiwidream and others added 2 commits October 28, 2026 09:50
The sidebar-width titlebar header sat in a content-sized column, so its
max-content width (traffic-light pad, app name, toggle, history buttons)
held the column open when the sidebar was dragged narrower. The freed
strip showed the transparent app background and the terminal never got
the width back. Contain the header's inline size so only the sidebar
sizes the column, and let the control group shrink so the app name clips
before the toggle and history buttons do.

The fork's long "Forca <version> (SwapLabs/<rev>)" label made this a
216px gap at the 220px minimum; upstream's "Orca" label leaves ~2px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…omed out

4ee7b3b stopped the titlebar header from widening the left column, but
on macOS the traffic-light pad is 80px / --ui-zoom-factor, so at UI zoom
-2.5 and below the pad, toggle and history buttons outgrew the 220px
sidebar minimum and the toggle slid under Go back (11px at -2.5, 22px at
-3), where a click no longer reached it.

Measure the width the header needs with the app name squeezed to its
padding, and raise the sidebar's effective minimum to it. The stored
width is untouched, so zooming back in restores it. At zoom 0 the need
(194px) is under 220, and Linux/Windows chrome has no pad, so neither
changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T14:42:48.695868Z 3d193c9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@kiwidream
kiwidream merged commit e9b0323 into swaplabs/main Oct 28, 2026
32 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