Skip to content

Open every text document in a fixed box from first paint - #3454

Merged
max-sixty merged 3 commits into
mainfrom
text-document-fixed-box
Oct 21, 2026
Merged

max-sixty merged 3 commits into
mainfrom
text-document-fixed-box

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Every lf-text-document now scrolls its listing in a box --lf-bound tall
(28rem by default), the same box a preview document's Source tab uses, and the
page keeps that size from its first paint. Before, a document without preview
was as tall as its text. The text arrives with the state answer after first
paint, so the listing grew when it landed and pushed the rest of the page down.
A short document now shows empty room under its last line, and a long one reads
by scrolling inside the box rather than at full length in the page.

The change is in the widget's registry entry and theme:

  • lf-text-document declares x-bound: start, so delivery marks every document
    as a bounded block, which makes its listing a reading region whether or not
    the author wrote data-bound. The listing's max-block-size becomes a fixed
    block-size.
  • Until the module draws the figure, the empty host wears the figure's frame,
    draws its label (or its source name) as the caption with the caption's rule,
    so it wraps the same way, and reserves the tab strip and the box. Its first box
    equals its drawn one in Chromium and Firefox, at 1440px and 390px, with and
    without a preview (483.4px and 530.4px).

Measured with leaf-dev probe on a page that opens with a 20-line document and
a paragraph under it: on main the paragraph moves from 114px to 547px at 1440px
wide (0.018 layout shift) and off the screen at 390px (0.030); on this branch
nothing moves at either width (0). On a page with three documents, one of them a
3-line one, the only shift left is inside a listing (0.12 at 1440px): the
module draws an empty listing under "· no data" before the text arrives, then
widens its gutter. TODO.md carries that as "Draw a text document's listing once
its text has arrived".

The widget-quality report no longer finds keeps-first-box on
lf-text-document, so its entry leaves tests/known_widget_findings.py, and
the TODO entry for this defect is gone. In the code-review test, reopening a
card anchored to the whole document now opens over the document's box rather
than under it, so the test accepts either.

Max's decision #4 on the overnight report, option C with the fixed height.

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

max-sixty and others added 3 commits October 20, 2026 23:55
Undoing a playground's submission now withdraws only the decision. The controls
keep the values the user left, ready to adjust and send again, and Reset still
returns them to the authored defaults. Before, undo replaced the working values
with the previous choice's values or, when none was left, the authored defaults,
so on alert-thresholds a page budget raised from 10 to 12, sent and undone jumped
back to 10.

A newly chosen action, from this tab or another, still replaces the working
values. The playground tells it from an earlier choice an undo makes current
again by log order: a choice replaces the values only when it is pending or its
seq is past every choice the tab has drawn. A refused choice now behaves like an
undo, leaving the values the user sent in the controls.

This reverses the rule in lf-playground.js's header, "a newly chosen action or
its undo must replace them", which the header now states the other way.

Tests: the alert-thresholds case is new; the contributor-draft test and the
structured-data explorer journey now expect undo and refusal to keep the edits
and Reset to restore the defaults.

Max's decision #26b on the overnight report.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Every `lf-text-document` now scrolls its listing in a box `--lf-bound` tall
(28rem by default), the same box a preview document's Source tab uses, and the
page keeps that size from its first paint. Before, a document without `preview`
was as tall as its text. The text arrives with the state answer after first
paint, so the listing grew when it landed and pushed the rest of the page down.
A short document now shows empty room under its last line, and a long one reads
by scrolling inside the box rather than at full length in the page.

The change is in the widget's registry entry and theme:

- `lf-text-document` declares `x-bound: start`, so delivery marks every document
  as a bounded block, which makes its listing a reading region whether or not
  the author wrote `data-bound`. The listing's `max-block-size` becomes a fixed
  `block-size`.
- Until the module draws the figure, the empty host wears the figure's frame,
  draws its label (or its source name) as the caption with the caption's rule,
  so it wraps the same way, and reserves the tab strip and the box. Its first box
  equals its drawn one in Chromium and Firefox, at 1440px and 390px, with and
  without a preview (483.4px and 530.4px).

Measured with `leaf-dev probe` on a page that opens with a 20-line document and
a paragraph under it: on main the paragraph moves from 114px to 547px at 1440px
wide (0.018 layout shift) and off the screen at 390px (0.030); on this branch
nothing moves at either width (0). On a page with three documents, one of them a
3-line one, the only shift left is inside a listing (0.12 at 1440px): the
module draws an empty listing under "· no data" before the text arrives, then
widens its gutter. TODO.md carries that as "Draw a text document's listing once
its text has arrived".

The widget-quality report no longer finds `keeps-first-box` on
`lf-text-document`, so its entry leaves `tests/known_widget_findings.py`, and
the TODO entry for this defect is gone. In the code-review test, reopening a
card anchored to the whole document now opens over the document's box rather
than under it, so the test accepts either.

Max's decision #4 on the overnight report, option C with the fixed height.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit c9255ac into main Oct 21, 2026
3 checks passed
@max-sixty
max-sixty deleted the text-document-fixed-box branch October 21, 2026 07:25
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