Repository navigation
Give a table its columns' width in a flex row, a grid track or a thread card - #5554
Conversation
…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
left a comment
There was a problem hiding this comment.
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
autotrack) it widens that box, so give the boxmin-width: 0to keep the table scrolling inside it. - Name
min-width: 0in thepast-columnorpage-scrollsremedy, 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]>
|
Both edits are in 8d96e05.
New test:
|
leaf-agent
left a comment
There was a problem hiding this comment.
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.
…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]>
|
Follow-up in 1c7a14a: the
Where
|
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
browser/styles/components/reading.css): nocontainer-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.browser/layouts.css): thecontainer-type: normal/scroll-statefallback and the inline-block caption override existed only to undo the containment, and are gone, with the "Scroll-state containers" entry innotes/browser-support.md.browser/layouts.css):contain: inline-size, as its aside already has throughcontainer-type. See "A call to review" below.past-columnfor 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 computedmin-inline-sizeisautocarriesitem: "flex"or"grid", read from the computed styles alone. Its message then offersmin-width: 0first and keeps the breakout and scrolling-box remedies after it. The check doesn't prove the fix in advance: wheremin-width: 0isn't what holds an item out, as for a neighbour the item pushed aside or an item in a fixed track, the nextpage check --renderreports 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.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 gridautotrack widens to the table's columns unless it takesmin-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.autotracklf-ask,lf-option,lf-tab, steps, a granted figure, a breakout, an auto-fit card grid,detailspage check --renderon the fixture, before: the 0px tables passed assqueezed-tableadvice 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 remainingsqueezed-tablefinding 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-captionfixture. 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 inpr-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 stillsforbreakout-captions-scrolledandtable-scrolled-sidewaysshows 0 changed pixels in Chromium and WebKit, andbreakout-captions-scrolled0 in Firefox (table-scrolled-sidewaystimes 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 anautotrack 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 --renderrefuses such a page:page-scrollsat 360–600px (254px at 360px) and at 680px (6px), andpast-columnnaming 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:The note beside it, also a flex item, reads the same words at 360–600px and at 680px; giving the note
min-width: 0is 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: 0was 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
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_phonefails without the sidebar containment.test_an_item_its_content_holds_past_the_column_is_told_to_drop_its_minimumreadsmisplacedBoxesat 390px on a flex item and a gridauto-track item, each holding a box that scrolls sideways, and on their pushed neighbours: all four carryitemand their message offersmin-width: 0before the other remedies. Its controls, a box the page sized to 600px and a flex item withmin-width: 600px, carry noitemand keep only the old remedies.past-columnchange:tests/model/test_render_gate.py(pins the existing remedy text), the browser tests that readmisplacedBoxes, and the journeystest_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_marginandtest_an_ordinary_page_is_drawn_as_written[dashboard]: all pass excepttest_an_obligation_spanning_its_block_is_a_breakout, inherited as below.tests/browserandtests/smokewhose 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_carryandtest_render_gate.py::test_an_obligation_spanning_its_block_is_a_breakout.test_the_render_gate_reports_a_table_squeezed_by_what_cannot_breakandtest_every_table_the_theme_sets_honestly_passes_the_gate: both pass.pnpm run test:runtime, since no runtime module changed; iOS Safari.