Skip to content

Give a table its columns' width in a flex row, a grid track or a thread card - #5554

Merged
max-sixty merged 3 commits into
mainfrom
grind/4035
Nov 5, 2026
Merged

max-sixty merged 3 commits into
mainfrom
grind/4035

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Closes #4035.

The reading face made every table an inline-size container, so that a wide table never widened what held it. Containment sizes a box as if it were empty, so a holder that takes its width from its content gave the table none. This removes the containment: a table asks its holder for its columns' width, as the browser's own table does, and still scrolls them inside a holder that gives it less. The issue asked whether a too-narrow table should fail a page at the fixed widths. It stays advice (squeezed-table). On the fixture below it reported 10 tables before this change; four were tables the containment had collapsed, which now take their columns' width and draw no finding, and a fifth, 0px wide before, is now reported at the 204–506px it scrolls in.

What changes

  • Tables (browser/styles/components/reading.css): no container-type. The caption, which read the container's width (max-inline-size: 100cqi), is now an inline block that asks the table for no width and fills its box (display: inline-block; vertical-align: top; inline-size: 0; min-inline-size: 100%), so it keeps to the visible part of a scrolling table and stays there as the columns scroll. A plain block passed in Chromium and Firefox, but Playwright WebKit scrolled a block's sticky caption away with the columns of a right-to-left table (test_a_scrolling_breakout_table_keeps_its_caption_in_its_scrollport[rtl-webkit_browser], caption at 321–663px in a 24–366px box); the inline block, which the breakout rule already used, holds in all three engines. The rule's header records the containment and why it went.
  • Breakout tables (browser/layouts.css): the container-type: normal / scroll-state fallback and the inline-block caption override existed only to undo the containment, and are gone, with the "Scroll-state containers" entry in notes/browser-support.md.
  • Sidebar page body (browser/layouts.css): contain: inline-size, as its aside already has through container-type. See "A call to review" below.
  • past-column for an item its content holds out (src/leaf/render-checks/layout.js, src/leaf/findings.py): an element reported past the column that is a flex or grid item whose computed min-inline-size is auto carries item: "flex" or "grid", read from the computed styles alone. Its message then offers min-width: 0 first and keeps the breakout and scrolling-box remedies after it. The check doesn't prove the fix in advance: where min-width: 0 isn't what holds an item out, as for a neighbour the item pushed aside or an item in a fixed track, the next page check --render reports it again and the other remedies stand. A box the page sized, and an item whose minimum the page set, are offered only the existing remedies.
  • Contract prose (skills/leaf/references/page-authoring.md): the reference said the reading face scrolls "a <pre> or table wider than its container, so neither needs a width". It now says a table scrolls inside a box that sets its own width (the column, a panel, any other block), and that a flex item or a grid auto track widens to the table's columns unless it takes min-width: 0. The <pre> half stands, since code blocks are still contained.

Evidence

Measured with leaf-dev probe --base (merge base 47f5a8f against this tree) on a fixture of the places agents put tables, in Chromium and Firefox at 360, 390, 768, 1440 and 1920px. Both engines read the same to within 1px.

Table Before After
Two small tables side by side in a flex row 0px, scrolling 113 and 125px 136 and 135px (148 and 147px from 768px), scrolling nothing
A headed table beside a note in a flex row 65px, one column out of the box 147–159px, scrolling nothing
A table in a grid's auto track 0px 142–154px, scrolling nothing
A seven-column table directly in a flex row 0px, all seven columns out of the box 204px at 360px to 506px from 768px, scrolling 285 to 55px
A seven-column table in a margin thread card, 1920px window card 388px, table scrolling 212px card 584px (a prose card's width), table scrolling 16px
Tables in the column, a panel, lf-ask, lf-option, lf-tab, steps, a granted figure, a breakout, an auto-fit card grid, details — unchanged

page check --render on the fixture, before: the 0px tables passed as squeezed-table advice telling the author "every column stays in reach"; the 65px table drew no finding. After, the findings on the tables that now fit are gone. Every remaining squeezed-table finding is a table scrolling inside a box at least 144px wide, where the message holds, so its wording (which an eval tied to fewer hidden columns, notes/agent-usability-evals.md, #3956) is unchanged.

Shipped pages. I read every visible table's box, height and scroll at 390 and 1440px, in both engines, on the 13 examples and site pages whose source holds a table and on the breakout-table-caption fixture. Nine of the pages and the fixture show tables on load, 21 in all, and none of those tables differs. Caption boxes now fill their table (three in pr-walkthrough, two in the fixture) where they used to fit their text; the text stands where it did, at the table's start. leaf-dev stills for breakout-captions-scrolled and table-scrolled-sideways shows 0 changed pixels in Chromium and WebKit, and breakout-captions-scrolled 0 in Firefox (table-scrolled-sideways times out in Firefox on base and head alike). The caption still names the table in both engines' accessibility trees.

Stills. Before/after crops are in the worktree's .tmp/t4035/stills/chromium/ and .tmp/t4035/stills/firefox/, named <section>-<width>-<before|after>.png, at 390 and 1440px:

  • s-flex: the two tables in a flex row are blank before and drawn whole after.
  • s-wrap: the headed table beside a note is a sliver before, its Spend column cut away, and whole after.
  • s-auto: the table in an auto track is blank before and whole after.
  • s-iwrap: the seven-column table in a flex item beside a note is a 72px sliver before. After, it stands whole, and at 390px it widens its row past the window, which pushes the note beside it out of the crop.
  • s-caption: the captioned table that scrolls on a phone reads the same before and after.
  • card-1920 (Chromium): the margin card holding a seven-column table, cut after its fourth column before, and at prose width after, with six of the seven columns in view.

What it costs

A wide table in a box an author sizes to its content, such as a flex item beside a note, now widens that box to its columns, past a phone's window where they need it. page check --render refuses such a page: page-scrolls at 360–600px (254px at 360px) and at 680px (6px), and past-column naming the pushed <div> and its sibling <p>. Before, it passed with the table 72px wide and six of its seven columns scrolled out of sight. The finding on the item offers the fix first, at 360–520px:

<div> in <div id=iwrap-row> is set 177px past the column, out in the margin; as a flex item it is by default no narrower than its content, so first give it min-width: 0, which keeps a wide table or scrolling box in it scrolling inside the column; or, to give it more room, mark it data-width="wide" or "available" rather than sizing it past the column, or scroll it sideways in a box of its own with overflow-x: auto and class="scroll"

The note beside it, also a flex item, reads the same words at 360–600px and at 680px; giving the note min-width: 0 is harmless, and once the item holding the table has it, both findings go. The page-authoring reference tells an author this before they write the row.

A call to review

Without the sidebar change, a sidebar page whose body (a section, not a .layout-column) holds a wide table was refused at 360–480px: the body is a flex item whose minimum is its content's, so the table widened the row up to 153px past the window. Containing the body, as the aside already is, makes the row set its width again; 14 sidebar pages (the site's, command-hub, feature-gallery, live-progress, pr-walkthrough, triage-board, sidebar-contents) lay out identically at nine widths from 360 to 1920px in both engines. min-inline-size: 0 was the first candidate, but in the Layout tier it resets a minimum the body declares, and the triage board then stood 504px beside its aside at 900px instead of across the row.

Tests

  • New: test_a_box_sized_to_its_content_gives_a_table_its_columns_width (Chromium, Firefox) fails on base, with three of its tables 0px wide and the headed one 77px; test_a_wide_table_scrolls_inside_a_sidebar_pages_body_on_a_phone fails without the sidebar containment.
  • New: test_an_item_its_content_holds_past_the_column_is_told_to_drop_its_minimum reads misplacedBoxes at 390px on a flex item and a grid auto-track item, each holding a box that scrolls sideways, and on their pushed neighbours: all four carry item and their message offers min-width: 0 before the other remedies. Its controls, a box the page sized to 600px and a flex item with min-width: 600px, carry no item and keep only the old remedies.
  • Rewritten docstrings of the two caption and prose-table tests that described the containment.
  • For the past-column change: tests/model/test_render_gate.py (pins the existing remedy text), the browser tests that read misplacedBoxes, and the journeys test_the_render_gate_tells_what_a_column_loses_from_what_stands_beside_it, test_the_render_gate_names_a_wide_widget_drawn_over_the_pages_own_margin and test_an_ordinary_page_is_drawn_as_written[dashboard]: all pass except test_an_obligation_spanning_its_block_is_a_breakout, inherited as below.
  • Ran 150 browser test nodes by node id: every test under tests/browser and tests/smoke whose source or page constant holds a table, a caption, a sidebar page or the squeeze reading, plus five breakout and caption tests found by name. 147 passed. The other three fail the same way on the merge base, so they are inherited: test_render_aim.py::test_target_brackets_and_focus_share_the_visible_boundary, test_render_aim.py::test_design_mode_reads_each_shape_of_control_into_the_anchor_its_routes_carry and test_render_gate.py::test_an_obligation_spanning_its_block_is_a_breakout.
  • Ran the render-gate journeys test_the_render_gate_reports_a_table_squeezed_by_what_cannot_break and test_every_table_the_theme_sets_honestly_passes_the_gate: both pass.
  • Not run: pnpm run test:runtime, since no runtime module changed; iOS Safari.

This was written by Claude Code on behalf of max-sixty

…ad card

The reading face made every table an inline-size container, so that a wide
table never widened what held it. Containment sizes a box as if it were empty,
so a holder that takes its width from its content gave the table none: two
tables side by side in a flex row, and one in a grid's `auto` track, stood 0px
wide at every width from 360px to 1920px; a headed table beside a note stood
65px with a column out of sight; and a thread card holding a seven-column
table stayed at its 388px minimum at 1920px, scrolling the table 212px, where
a card of prose reaches 584px. `page check --render` reported the 0px tables
only as `squeezed-table` advice, which told the author every column stayed in
reach, and the 65px one not at all.

The table now asks its holder for its columns' width, as the browser's own
table does. Its caption, which read the container's width (`100cqi`), is an
inline block that asks the table for no width and fills the table's box
(`inline-size: 0; min-inline-size: 100%`), so it still keeps to the visible
part of a scrolling table and stays there as the columns scroll. A block
caption did the same except in WebKit, which scrolled it away with the columns
of a right-to-left table. With the containment gone, a breakout table no longer
needs `container-type` set back to `normal` or `scroll-state`, nor a caption
rule of its own, and `notes/browser-support.md` loses the scroll-state entry
that existed for that fallback.

Of the Leaf boxes that hold a table (the column, a panel, `lf-ask`,
`lf-option`, `lf-tab`, steps, a granted figure, a note row, a sidebar page),
the sidebar page's body was the one the containment had been holding to the
window: the body is a flex item whose minimum is its content's, so a wide table
in it widened the row by up to 153px past a 360-480px window, which the render
check refuses. The body is now contained, as the aside already is, so the row sets
its width. `min-inline-size: 0` would do the same in the Layout tier but would
also reset a minimum the body declares, which narrowed the triage board's
board to 504px beside its aside at 900px, where it stands across the row.

What the change costs: a wide table in a flex item or other box an author
sizes to its content now widens that box to the columns, past a phone's
window if they need it. `page check --render` refuses that page as
`page-scrolls`, with `past-column` naming the pushed box, where the old
theme passed it with the table 72px wide.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The shipped authoring contract still makes the promise this change takes back. page-authoring.md tells agents that under the reading face "Leaf also scrolls a <pre> or table wider than its container, so neither needs a width." After this PR that holds only when the holder sets its own width, such as the column, a panel or a block. A flex item or a grid auto track now widens to the table's columns. As the PR's What it costs section says, a seven-column table beside a note then pushes the page past a phone's window.

An agent that follows the reference gets page-scrolls and past-column. The past-column remedy suggests a data-width breakout or a scrolling wrapper, and neither is the fix. The fix is min-width: 0 (or min-inline-size: 0) on the flex or grid item. So the agent's next attempt reads instructions that send it the wrong way, which is the trap AGENTS.md asks contract prose to avoid ("Written contracts describe the current code… change it and every consumer together, prose included").

Two edits would close it in this PR:

  • Narrow the page-authoring sentence: the table scrolls inside a holder that sets its own width. In a box sized to its content (a flex item, an auto track) it widens that box, so give the box min-width: 0 to keep the table scrolling inside it.
  • Name min-width: 0 in the past-column or page-scrolls remedy, or put it in a reference those findings point to.

…tent holds it past the column

With tables no longer contained, a wide table in a box sized to its content,
such as a flex item beside a note, widens that box past a phone's window. The
render check then reported `past-column` on the item with remedies that don't
apply to it: a `data-width` breakout, or a scrolling box of the author's own,
which still widens the item, since a scroll container inside a flex item
counts toward the item's minimum. `skills/leaf/references/page-authoring.md`
still promised that the reading face scrolls a table wider than its
container, which now holds only where the holder sets its own width.

`misplacedBoxes` now asks the remedy of each element it reports past the
column that is a flex or grid item with `min-width: auto`: it marks the item
for a rule that takes the minimum away, reads whether the item and everything
it holds then stand inside the column, and removes the mark and the rule. The
finding carries `item: "flex"` or `"grid"` when they do, and its message then
names `min-width: 0` on the item. A box the page sized, one in a fixed track,
or a neighbour the item pushed aside keeps the existing remedies, since taking
its minimum away doesn't bring it back. The probe marks the element with an
attribute rather than writing its style: the margin watches `style`
(margin-layout.js), and Chromium leaves `style=""` behind after
`removeAttribute`.

On the flex-item fixture at 360-520px, `page check --render` now reads:
"<div> in <div id=iwrap-row> is set 177px past the column, out in the margin;
as a flex item it is by default no narrower than its content, so give it
min-width: 0, and it keeps to the column while a wide table or scrolling box in
it scrolls instead".

The page-authoring reference now says a table scrolls inside a box that sets
its own width, and that a flex item or a grid `auto` track widens to the
table's columns unless it takes `min-width: 0`. Its `<pre>` half is unchanged,
since code blocks are still contained.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner Author

Both edits are in 8d96e05.

  • page-authoring.md: the sentence now says a table scrolls inside a box that sets its own width (the column, a panel, any other block). A flex item or a grid auto track widens to the table's columns, past a phone's window if they need it, unless the author gives that box min-width: 0. The <pre> half is unchanged, since code blocks are still contained on this head.
  • past-column: this is the finding that names the element; page-scrolls names only the page. For each element it reports that is a flex or grid item with min-width: auto, the check now takes the minimum away for one reading (through a marker attribute and a temporary rule, both removed). If the item and everything it holds then stand inside the column, the finding carries item and its message names min-width: 0. On the flex-item fixture at 360–520px it reads: "as a flex item it is by default no narrower than its content, so give it min-width: 0, and it keeps to the column while a wide table or scrolling box in it scrolls instead". A box the page sized, one in a fixed track, and a neighbour the item pushed aside keep the breakout and scrolling-box remedies, since removing their minimum doesn't bring them back.

New test: test_an_item_its_content_holds_past_the_column_is_told_to_drop_its_minimum. Also ran tests/model/test_render_gate.py, the browser tests that read misplacedBoxes, and the render-gate journeys that read past-column. All pass except test_an_obligation_spanning_its_block_is_a_breakout, which fails the same way on the merge base. The PR description's What changes, What it costs and Tests sections now cover both edits.

This was written by Claude Code on behalf of max-sixty

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This commit turns the test job red. The browser type check (pnpm run check) fails with src/leaf/render-checks/layout.js(534,17): error TS2339: Property 'remove' does not exist on type 'never' (run). minimumProbe is assigned only inside the heldOutByItsContent closure, so TypeScript's control-flow analysis still narrows it to its initial null after the loop and types ?.remove() as a call on never. With the cast in the inline suggestion, tsc --project browser/types/tsconfig.json passes locally. Apart from that, the push answers both points from the earlier review.

Comment thread src/leaf/render-checks/layout.js Resolved
…ad rather than probed

The previous commit checked that `min-width: 0` would bring an item back inside
the column before naming it: it marked the item, injected a rule, re-read the
layout and restored both, in the middle of a read-only pass. The agent's loop
already covers a wrong remedy, since the next `page check --render` reports the
element again, so the check needn't prove the fix in advance, and a write in
the middle of a read costs more to keep working than it saves.

`misplacedBoxes` now only reads: an element it reports past the column that is
a flex or grid item whose computed `min-inline-size` is `auto` carries `item`,
and the message offers `min-width: 0` first and keeps the breakout and
scrolling-box remedies after it. A pushed neighbour and an item in a fixed
track are offered it too, which is harmless to try; a box the page sized and an
item whose minimum the page set are not.

The test keeps its flex and grid cases; its controls are now a box the page
sized and a flex item with `min-width: 600px`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner Author

Follow-up in 1c7a14a: the past-column remedy now comes from a pure read. The check no longer marks the item, injects a rule and re-reads layout to prove the fix. An element reported past the column that is a flex or grid item whose computed min-inline-size is auto carries item, and its message offers min-width: 0 first, with the breakout and scrolling-box remedies after it:

as a flex item it is by default no narrower than its content, so first give it min-width: 0, which keeps a wide table or scrolling box in it scrolling inside the column; or, to give it more room, mark it data-width="wide" or "available" …

Where min-width: 0 isn't the cause, as for the neighbour the item pushed aside, the advice is harmless to try, and the next page check --render reports the element again with the other remedies. A box the page sized, and an item whose minimum the page set, get only the existing remedies. The test keeps its flex and grid cases with those two as controls. The model test that pins the remedy text, the misplacedBoxes browser tests and the past-column journeys pass; test_an_obligation_spanning_its_block_is_a_breakout fails the same way on the merge base.

This was written by Claude Code on behalf of max-sixty

@max-sixty
max-sixty merged commit eb6cb12 into main Nov 5, 2026
5 checks passed
@max-sixty
max-sixty deleted the grind/4035 branch November 5, 2026 22:33
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.

Decide whether a too-narrow table fails a page at the fixed widths

2 participants