Skip to content

fix(annotate): hide the collapsed sidebar tab flags when tools are hidden - #1226

Merged
backnotprop merged 1 commit into
mainfrom
fix/hide-sidebar-tabs-with-tools
Aug 7, 2026
Merged

fix(annotate): hide the collapsed sidebar tab flags when tools are hidden#1226
backnotprop merged 1 commit into
mainfrom
fix/hide-sidebar-tabs-with-tools

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

TLDR

Hide tools on a rendered HTML annotate session left the collapsed sidebar tab flags stuck to the left edge, so the page never actually went full screen. They now unmount with the rest of the overlay chrome and come back with Show tools.

Before / after

The header toggle is htmlToolsHidden in packages/editor/App.tsx (label: Hide tools / Show tools, rendered by AppHeader only when htmlSurface is true). It already hid two things:

  • the floating AnnotationToolstrip
  • the HtmlViewer action cluster (hideControls)

It did not hide SidebarTabs (packages/ui/components/sidebar/SidebarTabs.tsx), the collapsed tab strip that renders absolute left-0 top-0 whenever the sidebar is closed. Those are the "tongue" tabs: Table of Contents, Versions, Messages, Files, and the Agent TUI flag.

After: the same toggle drops the tab strip too. Both guards now read one derived value:

const htmlChromeHidden = isHtmlSurface && htmlToolsHidden;

The strip is unmounted, not faded or pointer-events: none, so its buttons leave the tab order entirely and nothing invisible remains hoverable or clickable over the page.

Scope decision

Applied to every surface where the toggle can exist, which today means HTML render sessions only.

htmlToolsHidden is not a global chrome state. AppHeader renders the button behind htmlSurface && onToggleHtmlTools, so plan review, markdown annotate, and archive have no hide-tools affordance at all and are untouched by this change. Keeping the isHtmlSurface factor in the derived value (rather than testing htmlToolsHidden alone) preserves that boundary if the state is ever reused, and it matches the guard the toolstrip was already using.

I did not extend hide-tools to markdown surfaces. That would be a new feature, not this bug, and the centered markdown column does not have the same edge-to-edge claim on the viewport that a raw HTML page does.

No lockout

Two independent ways back, neither of which the toggle hides:

  1. The header itself is never hidden, and the button flips to Show tools in place.
  2. Mod+B (toggleContents in packages/ui/shortcuts/plan-review/sidebar.shortcuts.ts) still opens the sidebar while tools are hidden. Mod+Shift+B for Files and Shift Shift for the Agent TUI are likewise unaffected.

The second test in the new file asserts exactly this: hide tools, confirm the strip is gone, press Mod+B, confirm the sidebar opens.

Files touched

  • packages/editor/App.tsx - derived htmlChromeHidden; applied to the SidebarTabs render and reused at the existing toolstrip guard
  • packages/editor/App.htmlHideTools.test.tsx - new DOM test, modeled on App.archiveReadOnly.test.tsx
  • .github/workflows/test.yml - registered the new file in the DOM_TESTS=1 step (the default bun test run skips DOM tests by design)

Tests

  • bun run typecheck clean
  • bun test 2938 pass, 271 skip, 0 fail
  • DOM_TESTS=1 bun test packages/editor/App.htmlHideTools.test.tsx 2 pass
  • Verified the new tests fail against the unpatched App.tsx, so they are not vacuous
  • Ran the new file in one process alongside App.archiveReadOnly.test.tsx, planDiffAutoExit.test.tsx, and actionsLabelMode.test.ts to check for cross-file interference

No server change. The toggle is component-local state, never persisted and never sent anywhere, so the two-runtime rule does not apply. apps/pi-extension/vendor.sh vendors only server and shared modules, so Pi picks this up from the same editor build.

Please eyeball in the browser

I cannot see the UI, so worth a quick look:

  • plannotator annotate somefile.html, hit Hide tools, confirm the left edge is genuinely clean with no residual sliver or hover target
  • Show tools restores both the strip and the toolstrip
  • The toolstrip's HTML-mode offset (left-3 when the sidebar is open, left-10 when closed) is unchanged, but confirm nothing shifted for the visible-tools case
  • With the sidebar open, hide tools: the open sidebar deliberately stays put (the strip only exists while the sidebar is closed). Confirm that reads as intended rather than as a missed case

The header's "Hide tools" toggle dropped the annotation toolstrip and the
HtmlViewer action cluster, but the collapsed sidebar tab flags kept
protruding from the left edge, so a rendered HTML page never actually got
the whole viewport.

Fold both overlay guards into one derived `htmlChromeHidden` and apply it
to the SidebarTabs render. The flags unmount rather than fade, so nothing
focusable stays in the tab order and no click target sits over the page.

The toggle only exists on HTML surfaces, and both restore paths stay
visible: "Show tools" lives in the header (never hidden), and Mod+B still
opens the sidebar directly.
@backnotprop
backnotprop merged commit 548497e into main Aug 7, 2026
15 checks passed
@backnotprop
backnotprop deleted the fix/hide-sidebar-tabs-with-tools branch August 7, 2026 01:29
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