Skip to content

Lay out a page Layout's box by its parent, not body > main - #3110

Merged
max-sixty merged 9 commits into
mainfrom
layout-box-parent
Oct 17, 2026
Merged

max-sixty merged 9 commits into
mainfrom
layout-box-parent

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

A page Layout's box is now main, or a child of a main that carries no Layout, and the box's parent is the shell it is placed in. This separates the two jobs body > main did: pageDocument stays the root of the page's content, and layoutBox is the box the Layout arranges. It is the first step toward pages of several views, each a child of main with its own Layout.

  • layouts.css: Layout rules match :is(main, main > *).layout-*. The box declares itself with --lf-layout-box and is the lf-content-frame style container that margin residents (the contents map) query. A main holding a Layout child is an inline-size container, so the child column's cqi measures that main. The column's shell grid is [data-lf-column-shell] on whichever element holds the column, and the first sidebar's margin slot moves from theme.css into the column Layout.
  • prepaint.js: layoutBox() finds the box from CSS's declaration. The margin pass, breakouts and sidebar tracks read the box and its parent instead of main and body, and measure room inside the shell's border and scrollbar gutters (a resident may still stand in its padding, as the rail does in the strip data-rail="right" gives up). A column that moves to another shell clears the old one's tracks. The column shift stays on body, root state a revision keeps, and the shell inherits it.
  • Consumers: the margin layout, the Layout's reading regions and the render checks that read the column, the workspace or the column's shell use layoutBox.
  • Delivery: the root's data-lf-layout also names the Layouts on main's children, except a child the page hides.
  • page-layout.md: a page Layout can go on a child of a main that carries none.

Nothing changes on a page whose main carries its Layout; none of the 64 tracked HTML pages puts a Layout on a child of main. A new browser test holds a column (shifted for its sidebar, and with a contents map) and a workspace on a child of main to the same geometry as on main, and a child column inside a narrowed, bordered or scrollbar-guttered main to that main's inner edges; it fails on main.

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

max-sixty and others added 2 commits October 16, 2026 23:12
A Layout's box is now `main`, or a child of a `main` that carries no
Layout, and its parent is the shell it is placed in. This separates the
two jobs `body > main` did: the root of the page's content stays
`pageDocument`, and the box the Layout arranges is `layoutBox`. It is the
first step toward pages of several views, each with its own Layout.

- layouts.css: Layout rules match `:is(main, main > *).layout-*`. The box
  declares itself (`--lf-layout-box`) and is the `lf-content-frame` style
  container margin residents ask; a `main` holding it is its shell and
  the size its `cqi` measure. The column's shell grid is
  `[data-lf-column-shell]` on whichever element holds the column, and the
  first sidebar's margin slot moves from the theme into the column Layout.
- prepaint.js: `layoutBox()` finds that box from CSS's declaration; the
  margin pass, breakouts and sidebar tracks read it and its parent instead
  of `main` and `body`, measuring room inside the shell's border, and a
  column that moves to another shell clears the old one's tracks. The column shift stays on `body`, root state a
  revision keeps, and the shell inherits it.
- The margin layout, the Layout's reading regions and the render checks
  that read the column, the workspace or the column's shell read
  `layoutBox`.
- Delivery's root `data-lf-layout` also names the Layouts on `main`'s
  children.

Nothing changes on a page whose `main` carries its Layout. A new test
holds a column (shifted for its sidebar, and with a contents map) and a
workspace on a child of `main` to the same geometry as on `main`, and a
child column inside a narrowed or bordered `main` to that `main`'s
content box; it fails on main.

Co-Authored-By: Claude Opus 5.5 (1M context) <[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 page-layout reference still says the three page Layouts “go on main.” This change makes a Layout on a child of main a supported page-authoring route, so an agent following that reference cannot discover the new route. Please update the owning authoring reference with when and how to place a Layout on a child, as required by AGENTS.md’s “Working on the repository” feature guidance.

Comment thread skills/leaf/scripts/leaf/structure.py Resolved
max-sixty and others added 5 commits October 16, 2026 23:19
The margin pass and the breakout render check measured the shell inside
its border only, so a `main` with scrollbar gutters admitted a sidebar
that the gutter then clipped. Both now read the shell's client box
(clientLeft, clientWidth), which excludes its border and gutters and
keeps its padding, where the rail stands under data-rail="right".

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
clientLeft and clientWidth are in the shell's own pixels, while its
bounding rectangle is in the window's, so a transform on the shell or
around it (body { transform: scale(.8) }) admitted a rail the room could
not hold, and the breakout check reported false past-room findings.
Both readings now scale the client box by the rectangle's width over
offsetWidth.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The owner-index test reads every code span in an owner cell as an
export of its module, so the parenthetical naming prepaint.js failed it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A page with a shown layout-column child beside a hidden layout-workspace
one named both on the root, so the workspace's body rules, such as the
rail strip's exclusion, applied to the column. page_layout now skips a
child of main the page hides, as layoutBox does. page-layout.md says a
page Layout can go on a child of a main that carries none.

Co-Authored-By: Claude Opus 5.5 (1M context) <[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 “Rail and the margin” section of page-layout.md still tells authors to read main’s data-lf-margin and gives a main:not([data-lf-margin~="sidebar"]) selector. On the newly documented child Layout route, prepaint.js writes those tokens to the Layout child, so that selector always takes its no-sidebar branch even when the sidebar stands in the margin. Please make this guidance target the Layout box and give a selector that works for both placements.

The column's data-lf-margin is on whichever box carries layout-column,
main or a child of it, so the example selector keys on that class.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 17, 2026
# Conflicts:
#	skills/leaf/kernel/kernel.json
@max-sixty
max-sixty merged commit 6e607ca into main Oct 17, 2026
3 checks passed
@max-sixty
max-sixty deleted the layout-box-parent branch October 17, 2026 07:57
max-sixty added a commit that referenced this pull request Oct 17, 2026
The banner, chrome-layout.js, queue-panel.js, test_banner.py and
test_shortcut_bar.py stay deleted; main's changes to them move to where
that code now lives. The approval refusal ("Answer every open widget
before approving this work", #3112) is in page-status.js, and the
Layout-box wording of #3110 in page-layout.js's header. queue-panel.js's
row word has no successor, since the On view's cards name no kind, so
askWord serves the walk and the ask view only. test_banner's agent
question and test_shortcut_bar's walk words ("· Options", "Next item
waiting on me") are carried into test_key_surfaces.py.

In conflicted tests the branch's panel selectors stand and main's
fixtures and words apply: lf-ask questions in place of `ask: true`
replies, and walk positions naming the widget ("Options", "Question").
The registry and events.md keep the branch's panel wording with #3114's
x-awaits `reply`/`yields` and question-in-words rows. The status
explanation the leaf's menu shows counts what waits on the user as
"N to answer" rather than "N asks", which #3112 left only because the
banner was going. The kernel and the layer-contract snapshot are
regenerated.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
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.

2 participants