Skip to content

Keep a workspace filling the window, and fit its widgets to the height - #2039

Merged
max-sixty merged 16 commits into
mainfrom
workspace-layout
Oct 9, 2026
Merged

max-sixty merged 16 commits into
mainfrom
workspace-layout

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

A workspace is a screen the reader moves through rather than scrolls, so it keeps filling the window whatever its body is, as it already does on main. The widgets that can be its body now fit themselves to that height instead of overflowing it: a visual review sizes its screenshot pair to the room it has, and a side-list queue scrolls its list and its open item separately, like a mail client.

An earlier version of this PR went the other way. It guessed from the body's structure whether a workspace should fill the window, and let a body that is one region scroll with the page. That took four :has() branches, a style-query split and new render-gate advice, and every review round found another structure it got wrong. All of it is gone, and those files match main again.

What changed

  • Visual review (lf-visual-review.js, visual-review/theme.css):
    • The gallery example is a workspace.
    • In a workspace, Fit sizes the pair to its evidence pane, so a case shows without scrolling.
    • Where fitting would take the pair below 70%, which puts a captured 16px line under 11px, it takes the stage's width and the pane scrolls instead.
    • In Flip, a focus crop's comparison takes the crop's shape rather than the whole capture's, and Fit counts lf-shot's rail.
  • Side-list queue (lf-tabs.js, default/theme.css):
    • The list and the open item each scroll on their own, and walking the list keeps the selected row in view.
    • When a large root font stacks the list over the item, the list takes its own row and the item takes the rest.
    • The panels are always reading regions, as panes are. The list is one only while it scrolls on its own.
  • --lf-full-height no longer inherits (layouts.css):
    • A box sets the token for the children it gives a definite height: main for the body, a grid of panes for its cells, and a pane for its body.
    • A widget that fills its height passes the token on to its own parts with --lf-full-height: inherit. The playground, the visual review, a two-part Ask and the side list do this.
    • The pane rules key on the token, so the main > … selectors in the Layout's pane rules and in the Ask's rules are gone.
    • A widget deeper in the body is no longer told it has a height. Before, the inherited token told it too, and a review inside a section measured its own content as its height and grew on every pass.
  • Contracts:
    • module-authoring.md "Reading regions", packages.md, assets/AGENTS.md and the glossary describe the token's new meaning.
    • The visual review's author instructions send a page that is only the review to a workspace.

Tests

  • A side-list workspace test covers separate scrolling, reading keys, walking the list, the stacked large-font case, and keeping the reader's place through a window that flows and fills again.
  • A review inside a section flows and settles.
  • The gallery test asserts that the pair fits at 1440×900, and that it takes the stage's width at 1366×768.
  • The rem-spacing test checks the gap in both postures.

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

max-sixty and others added 10 commits October 6, 2026 23:41
Asked to show a recording of a bug it had reproduced with Playwright, a
maintainer session put the screencast on its Leaf page as a <video>, did so
again when asked for "a playwright recording", and reached lf-trace only after
"I still see a movie?". The rule sending a trace to lf-trace lived only in
developing-leaf, which a /compact had dropped from that session's context; the
shipped media paragraph it did read sent every recording to native video.

authoring-evidence.md's media paragraph now shows a browser journey recorded
with Playwright as its trace in lf-trace, with the package and the command
that gives the import. SKILL.md routes recordings to that reference,
developing-leaf points at it instead of restating it, and recording.py's
docstring names the widget.

The new eval case playwright-recording-shows-its-trace failed 3/3 on Claude
Code at the base (video on the page, trace left off as "not page media") and
passed 3/3 with this change; Codex passed both arms. authored-recording,
playwright-trace-review and trace-review stayed green on both harnesses.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The user's rule: a page whose one significant element is a visual review
should not hold that element in a smaller scrolling box. The review's stage
had a fixed height (half its width in flow, or what a full-height workspace
left), scrolled its screenshots inside itself, and the package told authors
to make a lone review a workspace's body.

- The stage is now as tall as its captures and scrolls only sideways
  (`overflow: auto hidden`, since `visible` beside `auto` computes to
  `auto`). Compare, flip and overlay fit the captures to the stage's width;
  the room the chrome leaves in the window (`shownWindow`, now in the widget
  API) only chooses between side-by-side and stacked. The workspace-only
  bounded stage and the per-case reading region that paged it are gone.
- The package's author instructions and the gallery example make a lone
  review a `layout-wide` page.
- Reading regions announce a width change as a shift, not only a change of
  scroller, so continuity restores a visible editor that a rewrap pushed out
  of the window. Without it, a comment editor in a review at the top of the
  page left the window when it narrowed to a phone: the browser's scroll
  anchoring does nothing at offset 0, and the handover between a workspace
  pane and the page that used to trigger the restore no longer happens.
- A let-go no longer lands in a closed <details>. Its contents report boxes
  as if open, as an inactive tab's panel does, so the reading block could be
  a paragraph inside one, focus could not land there, and closing Threads
  left the user on its toggle. `blocksOnScreen` now skips what
  `checkVisibility()` says is not rendered, which covers [hidden] too.

Tests that asserted the inner scroller now assert its absence: in every
view and scale the stage shows its whole capture, a wheel or `d` over it
scrolls the page, and its height depends on the view, not the scroll
offset. The authenticated journey and the phone-resize editor case run on a
wide page; `go_to` scrolls a control into view before typing its hint, as a
reader would. The workspace-frame test builds its own workspace page.
`test_a_let_go_never_lands_in_a_closed_fold` fails without the landing fix.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…oice on the layout viewport

A review of the visual-review change found two more uses of the visibility
rule it had just fixed in `blocksOnScreen`. An Ask's arrival picked its
heading with `closest("[hidden]")`, which a closed <details> passes, and
neither check rejected a `visibility: hidden` block, which focus cannot
land on either. `showsWords` in passages.js now answers for both callers,
with `checkVisibility({ visibilityProperty: true })`.

The review's choice between side-by-side and stacked read the visual
viewport, so pinch-zooming a phone to 2x flipped a stacked pair side by
side and shrank the stage under the user's fingers. It reads the layout
viewport now.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ght frame for everything else

A workspace held its body to the window whatever the body was, so a page whose
body is one region (a lone lf-pane, a side-list queue, a visual review)
scrolled that region inside a box shorter than the window while the page never
moved. The bound pays off only where the reader keeps one region in view while
reading down another.

The Layout now fills the window only where the body is the page's grid of
regions with a pane among its cells (rows of panes included), or where a
widget's generated panes stand as siblings outside any authored pane, as a
playground's controls beside its preview. Any other body takes its content's
height and the page scrolls it. The frame is unchanged: no width cap, a 12px
gutter, a one-row header. So a page that is one tool, such as the visual-review
gallery, is a workspace again rather than a wide page with 58px gutters and a
70px band above the review.

`main` alone reads the panes, with a :has() that reaches the page's panes by
child steps (a search at any depth added ~0.5 ms to each write inside a pane on
a 40,000-element page; child steps add nothing measurable); the rules for the
boxes under main read --lf-full-height with a style query, so no :has() on main
stands ahead of an unkeyed rule.

The render gate advises where a body sets regions side by side and holds a pane
but does not fill the window, as when panes are wrapped one to a cell
(`unheld_regions`, from `heldPanes`, which now skips a widget body).

Guidance: page-authoring "A workspace" names the one-region case; the visual
review's author instructions route a review-only page to a workspace; registry,
module-authoring, glossary and the site's how-it-works say which panes scroll.
The wording was scored with the workspace-stacks-where-the-layout-flows eval
(claude-code): a rewrite of the section dropped it to 1 of 5; the shipped edit
passed 7 of 8, base 8 of 9.

Behavior the tests now hold: a lone pane, a pane holding panes, and two panes
written straight into main flow and the page scrolls them; alert-review's queue
is carried by the page; tests of how a held pane scrolls give it a neighbour
(beside_a_pane). annotation-workspace's conversations region becomes an lf-pane.
The visual review's own full-height rule goes.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	examples/developer/visual-review-gallery.html
#	skills/leaf/assets/runtime/reading-regions.js
#	skills/leaf/packages/visual-review/instructions/author.md
#	tests/test_render_projection.py
#	tests/test_render_visual_review_journey.py
# Conflicts:
#	.claude/skills/developing-leaf/references/glossary.md

@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.

A playground nested inside a one-region workspace still makes that workspace fill the window; the selector detail is inline.

Comment thread skills/leaf/assets/layouts.css Resolved
max-sixty and others added 2 commits October 8, 2026 00:26
A workspace fills the window only where panes stand side by side, so the lone
pane #2010's test used as a task boundary now flows with the page. The test
builds the boundary with beside_a_pane, as the other held-pane tests do.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…e body

The generated-pane condition matched at any depth outside an authored pane, so a
playground in a tab of a side-list queue held the whole queue to the window and
scrolled it inside a box, the posture this branch removes for a one-region body.
It now reaches the panes by child steps, as the authored-pane conditions do: the
widget is the body or a box directly in it (an Ask's answer), with its panes in
its own track box. A widget deeper in the body flows with the region holding it.

The flow test gains the tab-queue case, with a playground as the body and as an
Ask's answer as controls that still hold.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 8, 2026
leaf-agent
leaf-agent previously approved these changes Oct 8, 2026
Comment thread skills/leaf/assets/layouts.css Outdated
~ [data-lf-reading-role="pane"][data-lf-generated],
> :not(header, footer, [data-lf-reading-role="pane"])
> * > * > [data-lf-reading-role="pane"][data-lf-generated]
~ [data-lf-reading-role="pane"][data-lf-generated]

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@leaf-agent why is this so complicated? I'd have though things would be simple when defining something as fundamental as a Workspace

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 complexity comes from an unstated page choice: whether the workspace body should be held to the window. This selector tries to infer that choice from authored panes, generated panes at two nesting depths, and the position of a widget inside a tab. The nested-playground fix made the immediate behavior correct, but exposed that the Layout is reading the widget tree to decide the page's scrolling policy.

I think layout-workspace should own the shared frame, while the page explicitly opts into window height when it has regions the reader needs to keep side by side. That choice can still take effect only at suitable viewport sizes and set --lf-full-height for widgets that receive a definite height. Then a nested widget cannot change the page's posture, and these depth-specific :has() branches can go. I approved this too early; this boundary should be simplified before merge.

@leaf-agent
leaf-agent dismissed their stale review October 8, 2026 09:36

The full-height selector infers page scrolling policy from nested widget markup; the maintainer raised this architectural boundary after approval.

max-sixty and others added 3 commits October 8, 2026 15:56
# Conflicts:
#	tests/test_render_drafts.py
A workspace is a screen the reader moves through, so it keeps filling the window
whatever its body is. This replaces the branch's earlier approach, which guessed
from the body's structure whether to fill the window and let a one-region body
flow with the page: it took four :has() branches, a style-query split and new
render-gate advice, and every review round found another structure it got
wrong. Everything that approach changed is back to main's.

What fills the window now fits itself to the height instead:

- The visual review gallery is a workspace. In a workspace the review fills the
  window, and Fit sizes the pair to the room its evidence pane has, so a case
  shows without scrolling. Where fitting would take it below 70% (a captured
  16px line under 11px), the pair takes the stage's width and the pane scrolls
  it. Flip's comparison takes a focus crop's shape rather than the whole
  capture's, and Fit counts lf-shot's rail.
- A side-list queue (lf-tabs list="side") scrolls its list and its open item
  each on their own, as a mail client does. Walking the list keeps the selected
  row in view (#showTab now scrolls a column). Stacked over the item, as a large
  root font makes it, the list takes its own row and the item the rest.

`--lf-full-height` no longer inherits (@Property). A box sets it for the
children it gives a definite height: main for the body, a grid of panes for its
cells, a pane for its body, and a widget that fills its height passes it on to
its own parts with `--lf-full-height: inherit` (playground, visual review,
two-part Ask, side list). The pane rules key on it, so the `main > ...`
selectors in the Layout's pane rules and in the Ask's go. A widget deeper in
the body is not told and takes its content's height; before, an inherited token
told it too, and a review inside a section measured its own content as its
height and grew on every pass.

A side list's panels are reading regions in every posture, as panes are, so an
item keeps the reader's place when the workspace flows and fills again. Its
list is one only while it scrolls on its own: registered on a document page, its
row's own scrolling ended the size observers' pass with notifications
undelivered.

Tests: a side-list workspace test (separate scrolling, reading keys, walking,
the stacked large-font case, and the place kept through flow), a review inside
a section flows and settles, the gallery test asserts fitting at 1440x900 and
width at 1366x768, and the rem-spacing test checks the gap in both postures.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty max-sixty changed the title Fill a workspace's window only for side-by-side panes, and keep its tight frame for everything else Keep a workspace filling the window, and fit its widgets to the height Oct 9, 2026
@max-sixty
max-sixty merged commit d246484 into main Oct 9, 2026
6 checks passed
@max-sixty
max-sixty deleted the workspace-layout branch October 9, 2026 03:16
max-sixty added a commit that referenced this pull request Oct 9, 2026
Phase 3 landed as 1e9fad2. Each conflict is that squash meeting the phase 3 commits this branch holds, so each conflicted file is re-merged against phase 3's tip (8e85f82) as the base, leaving main's own later changes (#2116, #2039) to meet this phase's; none conflicts. The branch's diff against main is now exactly phase 4's.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 10, 2026
… the focus margin from the sticky-header slot (#2302)

Two follow-ups from #2039, each fixed where its cause is rather than
where it showed.

### A page keeps its place below the banner when the window changes
width

The follow-up said Leaf's reading-position code overrode the browser's
scroll anchoring for a pane on a document page: after a jump, narrowing
moved the landed line 36px. The pane was right. Below about 800px the
banner takes a second row, and the browser's anchoring keeps the
reader's line at the same distance from the window's top, which is then
under the taller banner. A plain document page left the line covered; a
pane only escaped because its own restore measures from the landing band
below the banner.

- `reading-regions.js` watches the page as it watches regions: its width
and the top of its landing band, announced as a shift with no region, in
the same measurement that announces main's window-height shifts.
`regionsSettled` waits for it. A band change without a width change,
such as a page tab strip arriving, is adopted rather than read as
unsettled.
- `version.js` moves the page with the band, then restores regions
against the new band from the readings snapshotted when the shift was
announced (#2303). The page keeps no record of its own: the browser's
anchoring already holds its words, and main now keeps a focused control
in view across the reflow.
- Narrowing then widening returns a pane's line to where the reader left
it (it ended 36px low).

### The focus margin is derived from the sticky-header slot; a visual
review's navigation stays in reach

The visual review's case navigation and view controls scrolled away
above a pair taller than the window. Sticking them needs focus inside a
stuck header to scroll nothing. #2135 did that by having each header
declare where its controls stand (`--lf-head-inset`) and each scroller
restate its landing room, so every new sticky header, the visual
review's two included, needed its own declarations.

- The layer's focus margin is read from the sticky-header slot
(`styles/components/surfaces.css`). A scroller's band has two parts, the
slot it covers whole (`--lf-top-covered`) and the room below it
(`--lf-landing-room`); the root's `scroll-padding-top` reads the same
two, and a box that scrolls restarts them (`state.css`). A focused box's
`--lf-top` less the covered slot is the headers over it the band does
not count, so it lands below them; a box in a header that sticks at its
top also takes the room back, so it counts as shown where it sticks.
- The runtime marks every box that sticks at its top (`data-lf-sticks`,
`reach.js`), so a header declares nothing unless its controls stand
inset from its stick line (the tab strip, the trace toolbar, the
screenshot toolbar). The thread title's and diff header's declarations,
the tab panels' landing-room restatement and `--lf-landing-gap` are
gone.
- The visual review's pane header sticks under the banner at a stated
height (two rows where the review is narrow) and stacks `--lf-top` for
the cases; the shown case's view controls stick under it. The capture
stage isolates its stacking, so a flip's handle and marked regions pass
under them.

The CSS changes are in the `styles/` sources (#2252); the committed
sheets are rebuilt from them.

### Tests

-
`test_a_page_keeps_its_place_below_the_banner_as_the_window_changes_width`
(document and pane): without the change, the document fails narrowing
and the pane fails widening.
- `test_a_visual_review_in_flow_keeps_its_navigation_over_a_tall_pair`:
without the change, the navigation stands 495px above the window.
- `test_focus_in_a_stuck_header_leaves_the_page_where_it_is` keeps
passing with every per-header declaration but the tab strip's removed.

> _This was written by Claude Code on behalf of max-sixty_

---------

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