Skip to content

ai-docs: collapsible rails and responsive table pattern [minor-release]#17

Merged
Tanq16 merged 2 commits into
mainfrom
feat/ai-docs-collapsible-layout
Jul 19, 2026
Merged

ai-docs: collapsible rails and responsive table pattern [minor-release]#17
Tanq16 merged 2 commits into
mainfrom
feat/ai-docs-collapsible-layout

Conversation

@Tanq16

@Tanq16 Tanq16 commented Jul 19, 2026

Copy link
Copy Markdown
Owner

What

Two changes to the embedded ai-docs viewer.

Collapsible rails. The file-tree sidebar and the right-hand TOC each get a toggle in the top bar. State persists in localStorage and is restored by a small <head> script so a collapsed rail never flashes open on load. The TOC toggle hides itself on docs with fewer than 3 headings and below the 1320px breakpoint, where the rail is already hidden.

Responsive tables. .prose table was width: 100% with overflow: hidden (there only to clip the border radius), so a many-column table squished its columns into unreadable slivers and silently clipped anything that could not shrink further.

Tables are now wrapped at render time in a .table-wrap scroll container. Cells carry a min-width floor (--table-col-min: 7rem) plus overflow-wrap: anywhere, so the table wraps its text while there is room and stops squishing at the floor, at which point the wrapper scrolls horizontally inside its own bounded box. Authors keep writing a plain <table>.

Also fixed along the way:

  • Note callout icons rode ~3.5px high against the first line (16px icon in a 24.5px line box). Now centered on the line box.
  • Wide tables silently clipped in the PDF export — cells wrap there instead.
  • .col needed min-width: 0, or a table inside .cols-2 forced the grid wider and ran under the TOC rail.
  • Live-reload was racing: loadDocs() fired .click() without awaiting it, so the scroll-to-top landed after the scroll-position restore.

Verification

Headless measurements across 1200 / 1400 / 1600 / 1920px and all four collapse states:

Check Result
Table crosses into the TOC rail never
Table past the article box, or page scrolls sideways never
9-column table at 1600px, both rails open scrolls (1008px in a 968px box)
…same table, sidebar collapsed stops scrolling, wraps (box grows to 1068px)
…both rails collapsed fully readable, no scroll (1151px)
Nested .table-wrap after live reload 0
Collapsed sidebar in the tab order removed via visibility: hidden
Callout icon vs first-line center 0.72px (was ~3.5px)

go build ./... and go test ./... pass.

Implemented via a workflow: recon, implement, then a 4-lens verify panel (layout / tables / regressions / discipline) with each finding put through an adversarial refutation pass. 4 of the raised findings survived and were fixed; the .col overflow and the live-reload race came out of that pass.

Notes

Two judgment calls worth a look:

  • The 7rem column floor is uniform, so a column of short values reserves as much width as a prose column and wide tables tip into scrolling slightly earlier than strictly necessary. Tunable in one place.
  • .content-wrap keeps its max-width: 1380px, so above ~1920px collapsing the sidebar re-centers rather than widening. Left as-is since it is existing typography intent.

🤖 Generated with Claude Code

Tanq16 added 2 commits July 18, 2026 22:25
The file-tree sidebar and the right-hand TOC are both collapsible from
the top bar, persisted across reloads and restored before first paint.

Tables were width:100% with overflow:hidden, so a many-column table
squished its columns into slivers and clipped whatever could not shrink
further. They now wrap while there is room and switch to scrolling
inside their own bounded container once columns hit a readable floor,
without ever crossing into the TOC rail.

Also fixes note callout icons riding high against the first line, and
wide tables silently clipping in the PDF export.
@Tanq16
Tanq16 merged commit 8a09782 into main Jul 19, 2026
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