Repository navigation
Leave a page that takes no theme its own tables, code blocks and code colours - #5049
Merged
Merged
Conversation
… colours A page that takes no theme, such as a reveal.js deck the user brings, kept three of Leaf's restylings (#5025). Every table became a block that scrolls its columns, so a table the page sized to `width: 100%` shrank its rows to their content inside a full-width border. Every code block took an 8px float under its last line. Every `pre > code` with a `language-…` class was recoloured, deleting the page's own token spans. The scroll model (a table or code block scrolls inside itself, an identifier breaks anywhere, paper wraps code) now stands in the reading face (`reading.css`), beside the face's other element rules, instead of reaching every page. The reading theme turns the face on for the whole page, and Leaf's own surfaces (transcripts, rendered Markdown, the chrome, lf-code) turn it on for themselves, so every themed page and every Leaf surface keeps it. A page without the face keeps the browser's table and pre. Where that runs past the window, `page check --render` refuses the page and names the element (`page-scrolls`, `clipped-out`), which is the check already in the agent's path. No CSS keeps a table scrollable without making it a block, and a block detaches the author's width, border and ground from the grid, so the scroll model can't stay on such a page without breaking its tables. `highlightBlocks` (`syntax.js`) colours a block only when it holds only text and wears the face. A block holding elements was marked up by its author, on any page; Leaf's own spans from an earlier pass still count as text, so a revision that changes the language recolours. The token palette is drawn for the face's code ground, so on a page without the face it was light-scheme ink on the page's own dark ground. A block not yet in the document has no face to read and is coloured, which keeps a message drawn before it is placed coloured. The breakout rule for a table in a Layout (`layouts.css`) assumed the face's block table and now applies with it. ## Evidence The issue's repro, a no-theme page with a `width: 100%` table, a pre-highlighted YAML block and a plain one, through `leaf-dev probe`: | | before | after | | --- | --- | --- | | table display / row width | block / 117px of 720 | table / 718px | | own token spans kept / Leaf spans | 0 / 4 | 4 / 0 | | plain block recoloured | yes | no | | pre height (content + padding 72px) | 80px | 72px | `tests/browser/test_plain_pages.py` now also compares the size of every box the author wrote, since all three restylings left every authored property computing the same. A new fixture, `deck.html`, holds the issue's pattern. Against the base CSS the test fails on `deck` (colours, added spans, sizes), `article` (its own `width: 100%` table drawn 291px of 687) and `dashboard`; with the change they pass. ## What changes for plain pages The dashboard fixture's six-column table is wider than a window under 760px. Leaf used to scroll it inside itself; now the gate refuses the page there, as it refuses any page that scrolls sideways, since the live root clips sideways overflow. That replaces the `scroll-clearance` obstacle it was pinned for with `sideways-clip`. The size reading also found two older departures, pinned as `class-vocabulary`: an author's `dl.facts` takes the facts list's grid and an author's `.choice` takes a choice target's aim floor, because both class names are Leaf's on every page. Co-Authored-By: Claude Opus 5.5 <[email protected]>
leaf-agent
reviewed
Nov 2, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The Markup guidance still promises that Leaf scrolls wide tables and code blocks “whatever theme the page takes” and tells authors to leave table widths and wrapping to Leaf. With this change, a no-theme page no longer gets that scrolling, so following the shipped instructions can leave its table clipped and refused by the render gate. Update that paragraph to scope the automatic behaviour to the reading face and explain that a no-theme page supplies its own overflow treatment. The new “Style the page” wording does not clear the contradictory instruction later in the same reference.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
#5048 landed `data-style="own"` while this branch was open. The merge keeps it working: its exclusions now stand on the scroll-model rules in the reading face, and `colouredAs` checks it beside the face and the text-only rule. On a page that takes no theme the attribute now changes nothing, so page-authoring.md offers it for content embedded in a page that takes a theme. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # dist/kernel/kernel.json
#5048 added `data-style="own"` to keep a subtree out of Leaf's table and code restyling. With the reading face now carrying that restyling, the attribute did nothing on a page that takes no theme, and on a themed page it removed only part of what the face input does: the face's table font, margins and muted headings still reached the subtree. One capability gets one API (root `AGENTS.md`, "Fix the underlying issue"), so the attribute goes: its selector exclusions in `reading.css`, its check in `syntax.js`, its feature-gallery section and stills state, and the plain fixture that carried it (`deck.html` holds the same pattern with no attribute). Content with its own design inside a themed page sits in a box that sets `--lf-reading-face: initial`, the value Leaf's own `:host` rule uses to take the face away. `package-themes.md` now documents that value beside `1`, and `page-authoring.md` points to it in one sentence. #5048's test becomes a test of the face input: a box off the face keeps a native `width: 100%` table, its own token spans and colours, no `pre` spacer and an uncoloured plain block, and a comment still anchors on a word inside it. Run with the face left on (`1`), the test fails on the table's `display`. A probe of the same page with a seeded comment (`leaf-dev probe --log`) read the table at 680px of 688, the page's token kept at rgb(160, 20, 80) with no Leaf spans, no `::after` on the block, and the comment's mark on the token. The code block outside the box stayed coloured with its clearance. The attribute landed hours before this change, and no page depends on it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…me breakout table
Review fixes on the face-scoped scroll model.
The authoring references still said Leaf scrolls a wide `<pre>` or table
"whatever theme the page takes" and that `<code>` breaks inside a cell.
Both now hold only under the reading face, so `page-authoring.md`
("Markup"), `page-layout.md` and the core registry's `table` entry say so,
and send a page without the face to a box of its own that scrolls
sideways (`overflow-x: auto` with `class="scroll"`).
The `past-column` finding told the author to mark the box
`data-width="wide"`, which leaves a native table that is wider than a
narrow window still too wide. It now also offers the scrolling box.
`package-themes.md` says `--lf-reading-face: initial` goes on a wrapper,
because each face rule reads the element's parent, so the box that sets
it still wears the face.
On a page that takes no theme and uses a Layout, a `data-width="wide"`
table took the breakout's `inline-size: 100%` and spread two one-word
columns over the whole 908px track. The breakout table's max-content
width, start alignment and `contain: none` now apply with or without the
face, and only the scroll container, the column-wide minimum and the
caption's inline block stay face-only. Probed at 1440px in Chromium and
Firefox, that table went from 908px to 120px, and a seven-column one from
908px to its 705px of content. `serve` takes `theme=False` for the new
render test, which fails without the change (rows 904px in a 720px
column).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The core registry's `table` description says a page without the face keeps the browser's table, and its next sentence, on putting identifiers in `<code>` so they break inside a cell, holds only under the face too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
max-sixty
marked this pull request as ready for review
November 2, 2026 06:14
leaf-agent
approved these changes
Nov 2, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 3, 2026
Since #5049, a page that takes no theme keeps the browser's own tables and code blocks, so one wider than the window no longer scrolls inside its own box. Leaf's root rule `html[data-lf-live] { overflow-x: hidden }` (`browser/base.css`) then stopped the page itself scrolling sideways, and the far side couldn't be reached at all. This deletes the rule. A page wider than the window now pans sideways, as on the open web, and `page check --render` still refuses it (`page-scrolls`), so an agent still fixes the overflow before handing the page over. The rule came in when the root became Leaf's document scroller (26feec8), as what was left of the earlier `html { overflow: hidden }` from when `body` scrolled, and #439 carried it into the render-blocking theme. Neither commit gives a reason for the sideways clip. ## What changed - `browser/base.css`: the rule is gone. The root's comment now says the root scrolls on both axes and that the gate refuses a page wider than the window. - Five comments gave the clip as their reason and now give the sideways scroll and the gate's refusal: the body's `overflow-wrap` and the media `max-width` rules (`base.css`), the pin count's left placement (`annotation-theme.css`), the rail carrier's note on the document's sideways scroll (`margin-layout.js`), and the reading face's header (`reading.css`). The rules themselves stay, since each still keeps content inside its box. The `margin-layout.js` comment moves the kernel's input hash (`dist/kernel/kernel.json`). - `tests/journeys/test_plain_pages.py`: the dashboard's `clipped-out <table>` pin no longer occurs, because the root no longer clips the table, so it goes. The obstacle is renamed `sideways-refusal` and names only the gate's refusal. `page-scrolls` and `past-column` stay pinned. - `tests/browser/test_render_gate.py`: `test_a_page_wider_than_the_window_scrolls_sideways_to_its_far_side` serves a no-theme page holding a `nowrap` table at 390px and wheels over the table until its last column is in the window. With the rule restored, it fails: the wheel never moves the page. ## Behaviour that changed - A page wider than the window scrolls sideways by wheel and the arrow keys (measured below). Touch and trackpad panning use the same native root scroll and weren't driven. Where the platform draws classic scrollbars, such a page should show a horizontal bar at the window's foot; that wasn't captured. - The render gate now reads the root as a scroller on both axes. Content past the window's right edge is reported through `page-scrolls`, and no longer also as `clipped-out` by the root (the dashboard pin above) or, by the same reading of the root's overflow in `reachability.js`, as `clipped-control`. Content carried off the leading edge, which no scroll reaches, is still `clipped-out` (`test_the_render_gate_tells_what_a_column_loses_from_what_stands_beside_it` passes). ## Measured **A no-theme page with a wide table.** The plain `dashboard` fixture, initialized `--no-theme --no-packages` and served by `bin/leaf server start` under a fresh state home, read by `leaf-dev probe` with a journey that brings the table into the window, wheels 1000px sideways over it, then returns and presses ArrowRight twelve times. At 390×844 the last column stands at 419–563px and the page overflows by 173px in both versions. | engine | before: wheel / arrows | after: wheel / arrows | | --- | --- | --- | | Chromium | 0px / 0px | 173px / 173px | | Firefox | 0px / 0px | 173px / 173px | | WebKit | 0px / 0px | 173px / 0px | After a 173px scroll the last column stands at 246–390px, whole in the window. WebKit under Playwright doesn't scroll for synthetic arrow keys at all: ArrowUp doesn't move it vertically either, in either version. At 1440×900 nothing overflows in either version and nothing moves. **Leaf's own chrome.** `scrollWidth` counts overflow under `overflow-x: hidden` too, so the page's sideways overflow (the gate's `rootOverflow`) reads the same in both versions; any state above 0 would be one the user can now pan sideways. Across 48 `leaf-dev stills` states, each driven by its stills driver on a fresh page — the floating panel and the leaf's menu, margin cards and their replies, the thread view on a phone, Threads, the more menu, page search, the page map, the contents, capture, the phone margin, touch and narrow variants, and pages whose own tables and diagrams scroll sideways — the overflow was 0 in every state that completed: 47 in Chromium, 45 in Firefox and 46 in WebKit. `plan-card-beside` fails in its driver in all three engines, and `table-scrolled-phone` in Firefox; both fail the same way on `main` (checked in Chromium and Firefox respectively). `live-sample-embedded-phone` was read in Chromium only, since the feature gallery hung Firefox's run. Every margin row of `review-a-plan`, pointed at so it unfolds, at 20 window widths from 390 to 1640px (pins up to 900px, the rail from 1000px), also gave 0 in Chromium and Firefox. **Stills.** `leaf-dev stills` against the merge base for 16 of those states: in every one, the only computed-style difference is `html` `overflow-x: hidden -> auto`. Pixels are unchanged except in two states. `margin-gallery-phone` differed by an overlay scrollbar's fade and was unchanged on a rerun. `plan-thread-phone` differs on both runs: after the stills driver presses the stop thread's marker on a phone, the page stands 421px higher in one version than the other. That scroll comes from Playwright, not from the press. I ran the driver's sequence 25 times on `main` (3cbb347) and 25 on this branch, interleaved in one Chromium with the arm order alternating each round, alternating motion settings, and the host's load at 6–7. The page scrolled in 3 of 25 runs on `main` (12%) and 8 of 25 on the branch (32%), two-sided Fisher exact p = 0.17. In all 11 runs that scrolled, the page had moved before `pointerdown` reached it. Playwright's click scrolls its target into view first, and in each of those runs it read the marker's box at top 2470px, where the marker stood before the driver's scroll. The marker was painted at 281px, so Playwright scrolled 421px toward the stale box. A real tap does no scroll-into-view, and Leaf focuses the marker with `preventScroll`, so a user's tap scrolls the page in neither version. The stale box itself is already on `main`. In the same sequence without the press, the marker's box and `elementFromPoint` at the place it is painted lagged the scroll in 6 of 12 runs on `main` and 4 of 12 on the branch (p = 0.68), for 28–30 frames either way. During that half second, a press where the marker is painted doesn't reach it; whether the paint lags too wasn't checked. The rate at which Playwright's check lands in the lag does depend on the version in this harness: under reduced motion the branch scrolled in 11 of 32 click runs and `main` in none (p = 0.0003), while under normal motion it was 3 of 13 each. A test that clicks a margin marker on a phone right after an instant scroll may therefore meet Playwright's scroll more often on this branch. The lag is the defect to fix, and it belongs to its own change. Not measured: frames during motion, and a WebKit keyboard route. ## Checks - The new test passes, and fails with the rule restored. - `tests/browser/test_render_gate.py -k` over the no-theme breakout table, the root scrollport's sideways room, page overflow beside an authored scroller, the page edge and the too-wide table: 6 passed. - `tests/journeys/test_plain_pages.py`: 9 passed, 3 xfailed with the updated pins. In `tests/journeys/test_render_gate.py`, the page that scrolls sideways only between viewports, what a column loses, and a box its container clips away: passed. - `pnpm run check`, which includes the runtime's 750 tests and the kernel comparison: passed. `uv run pre-commit run --files` on the changed files: passed. > _This was written by Claude Code on behalf of max-sixty_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #5025, which #5048 closed with
data-style="own"while this branch was open.A page that takes no theme, such as a reveal.js deck the user brings, kept three of Leaf's restylings:
width: 100%shrank its rows to their content inside a full-width border;pre > codewith alanguage-…class was recoloured, which deleted the page's own token spans.None of the three needs a subtree opt-out. Each was a reading-face rule that reached every page, so this moves each into the face. A page that takes no theme then keeps its own tables and code with no attribute.
It also removes
data-style="own", which #5048 added hours earlier (see the section on removing it, below). Content with its own design inside a themed page uses the face input instead.What changed
The scroll model is now part of the reading face (
browser/styles/components/reading.css). Before, it reached every page. The model covers four rules: a table or code block scrolls inside itself, the 8px clearance under it, an identifier breaks anywhere, and paper wraps code. The reading theme turns the face on for the whole page. Leaf's own surfaces (transcripts, rendered Markdown, the chrome, lf-code) turn it on for themselves. So every themed page and every Leaf surface keeps the model. A page without the face keeps the browser's table and pre. Where one of those runs past the window,page check --renderrefuses the page and names the element (page-scrolls,clipped-out). That check is already in the agent's path (AGENTS.md, "Leaf's role").No CSS keeps a table scrollable without making it a block. A block box detaches the author's width, border and ground from the table grid inside it. So the scroll model can't stay on a page like this without breaking its tables.
highlightBlocks(browser/runtime/syntax.js) colours a block only when it holds only text and wears the face.The breakout rule for a table in a Layout (
browser/layouts.css) is split in two. Its scroll container, its column-wide minimum and its inline-block caption assumed the face's block table, so they now apply only under the face. On a native table the caption rule would have pulled the caption out of its caption box. Its max-content width, start alignment andcontain: noneapply with or without the face. Otherwise adata-width="wide"table on a no-theme page took the breakout'sinline-size: 100%, which spread two one-word columns over a 908px track. With the fix the table measures 120px, in Chromium and Firefox. A new render test covers it, usingserve(theme=False).The shipped references now say that the scrolling of wide tables and code blocks, identifiers breaking inside cells, and code colouring hold only under the face:
package-themes.md,module-reading.md,page-authoring.md("Markup" and "Style the page"),page-layout.md, and the core registry'stableentry. A page without the face is sent to a box of its own that scrolls sideways (overflow-x: autowithclass="scroll"). Thepast-columnfinding offers that box too, besidedata-width, becausedata-widthdoesn't help a native table that is wider than a narrow window.Evidence
The issue's repro was a no-theme page holding a
width: 100%table, a YAML block the page highlighted itself, and a plain YAML block. I read it throughleaf-dev probeagainst a page served bybin/leaf server start:block/ 117px of 720table/ 718pxtests/browser/test_plain_pages.pynow also compares the size of every box the author wrote insidebody. All three restylings had left every property the author declared computing the same, so the old comparison missed them. A new fixture,tests/fixtures/plain/deck.html, holds the issue's pattern.Against the base CSS and runtime, the test fails on:
deck: colours, added spans and sizes;article: its ownwidth: 100%table is drawn 291px wide instead of 687;dashboard.With this change, all three pass.
What this changes for plain pages
The dashboard fixture has a six-column table that is wider than a window under 760px. Leaf used to scroll it inside itself. Now the gate refuses the page at those widths, as it refuses any page that scrolls sideways, because the live root clips sideways overflow. The fixture's pin moves from the
scroll-clearanceobstacle to a new one,sideways-clip. A page author meets the same refusal on a wide table and answers it in the page's own CSS.The size comparison also found two older departures, pinned as
class-vocabulary. An author'sdl.factstakes the facts list's grid, and an author's.choicetakes a choice target's aim floor, because Leaf owns both class names on every page. This PR doesn't change either.Removing
data-style="own"#5048 landed this attribute through automated triage while this branch was open. After the root fix above, it no longer earns a second API for one capability (root
AGENTS.md, "Fix the underlying issue"):data-style="own"onmainstill read the face's 18px table margin, its sans table font and its muted 13px headings.--lf-reading-face: initialon a box takes the whole face from the markup inside it. It works on a wrapper only: each face rule reads the element's parent, so the box that sets it still wears the face. Set on a table itself, the table stays a block with the face's margin and font.package-themes.mdsays to put it on a wrapper.initialis the value Leaf's own:hostrule uses to take the face away.package-themes.md("Personal themes") now documents it beside1.The attribute had been on
mainfor hours and no page uses it. This branch deletes its selector exclusions inreading.css, its check insyntax.js, its feature-gallery section and stills state, and its plain fixture;deck.htmlholds the same pattern with no attribute. #5048's test becomestest_a_box_off_the_reading_face_keeps_its_own_tables_code_and_comments. #5048 tested the attribute on a section, a table and a pre. The new test covers the wrapping section only, the one placement where the face input works. The paragraph #5048 added topage-authoring.mdbecomes one sentence pointing at the face input. I kept that sentence because the theme-inputs table inpackages.mdlists only--lf-reading-face: 1, so an author embedding a design wouldn't learn how to turn the face off.Before deleting it, I proved the replacement on a themed page with a
--lf-reading-face: initialsection and a comment seeded inside it (leaf-dev probe --log). Thewidth: 100%table stayed native at 680px of 688. The page's token kept rgb(160, 20, 80) with no Leaf spans. The block had no::afterand a plain block stayed uncoloured. The comment's mark landed on the token. The code block outside the section stayed coloured, with its clearance. The converted test fails when the section sets1instead (displayreadsblock).Calls Max may reverse
data-style="own"is removed in favour of the face input (above). Reverting commit344523293restores it.html[data-lf-live] { overflow-x: hidden }(browser/base.css). On a 390px window the table's last cell stays at 715px and the wheel moves the page 0px. With the rule lifted, the wheel moves the page 582px and the cell comes into view. Removing that rule is a separate decision, put to Max on his page, and not part of this PR. Removing it alone would not unblock such a page either, since the render gate still refuses a page that scrolls sideways (page-scrolls).--lf-reading-face: 1on a box around the code.Checks run
test_plain_pages, on every fixture by-k: 6 passed and 3 xfailed with the new pins. Against the base CSS,deck,articleanddashboardfailed.test_render_anchors,-k "marked_up or rewritten_while or aliases or colored_without or code_copy": 12 passed. This includes a new test,test_a_block_its_author_marked_up_keeps_its_markup.test_render_gate,-kcovering scrollbar clearance, scrolling tables, the squeeze reading, the syntax probe and table widths: 14 passed.test_an_agent_message_edit_updates_the_panel_and_its_inline_threadandtest_a_reply_renders_the_markdown_it_was_written_inboth passed.pnpm run test:runtime: 737 passed.pnpm run build:browserregenerated the kernel.leaf-dev stills 2a9d00dc5captured 57 states, reading 33 of the catalogue's 34 source pages at least once, with extra table, code-block and thread states. Neither pixels nor computed styles changed in any of them, except for noise. The three About states differ in the diagnostic text they print, with no style difference.on-mediffered once, inside a closed disclosure whose widget had upgraded in only one arm, and was unchanged on a rerun. The 34th page's state,thread-choice-hints, times out on both arms. I stopped the full 328-state run because the machine's load stood at 60–90 and the run would have taken hours.leaf-dev probe --browser firefox: the same readings as Chromium. Without a theme, all three restylings are gone. With the reading theme, the page's own highlighted block keeps its spans, and the plain block, the table's scrolling and the clearance are as before.mainand removing the attribute: the syntax tests with the converted face-input test (13 passed), every plain fixture (6 passed, 3 xfailed),test_page_fixtures_pass_checkon the feature gallery, the gate and thread selections (16 passed at the first merge), andtest:runtime(737 passed). Before the removal,leaf-dev stills origin/mainshowednative-code,table-scrolled-phone,breakout-captionsandthread-code-copyunchanged. The 57-state reading above was taken before either merge.5e656b671): the table, face and syntax selections intest_render_gateandtest_render_anchors(18 passed), every plain fixture (6 passed, 3 xfailed),tests/model/test_render_gate.py(9 passed),pnpm run check:browser, andleaf-dev stills 38eacfe38onbreakout-captions(three states),gallery-wide-schedule,table-scrolled-phoneandon-me. All were unchanged excepton-me, which showed the same timing noise in a closed disclosure, with no change to its table.mainagain (Show a reveal.js fragment's comment row once the fragment appears #5042 and later) and scoping the registry's identifier advice (fef592879):pnpm run check:browserpassed, andtest_render_gate's table, caption, breakout and clearance selection passed, 15 tests including the new breakout test.Not verified
layouts.css) or anything later.