Repository navigation
fix: fold from the menu's row in one paint, as the fold key does - #5263
Merged
Merged
Conversation
The menu's "Fold to the leaf" row ran through putAwayThen, which closed the menu (painting the open, empty panel, whose field says an error about nothing and so takes the leaf's error dot away) before the fold command painted the folded panel and put the dot back. The write watch reports that restated `data-shown` on the file-editor example's stale-key sweep. The row now runs the fold command directly; setRest already takes the view away and keeps focus on the leaf, as the `.` key relies on. What the user sees after the press is unchanged. Closes #5183
max-sixty
added a commit
that referenced
this pull request
Nov 4, 2026
… a page's CSS can't name (#5244) Leaf wrote 84 data attributes on its own elements outside the `lf-` namespace that `page check` reserves for it: the floating panel's state (`data-open`, `data-rest`, `data-shown`, `data-expanded`, `data-tone` and two dozen more), a thread's and a message's identity (`data-thread`, `data-event`, `data-message`, `data-attempt`), the paint boxes' `data-for`, the composer's `data-words` and send corner, and the parts the bundled widgets draw: lf-code's line numbers and elided rows, lf-tabs' scroll buttons, the trace timeline's marks, the timeline's events, the deck's pips, the call diff's lines and the diff's file rows. It also wrote the `scroll` class on its own scroll surfaces. A page's own CSS for one of those names restyled Leaf. On a probe page whose `<style>` held `[data-tone] { --warn: red }`, `[data-event] { --lf-msg-text-end: 123px }`, `[data-line] { background: blue }` and `.scroll { outline: 4px solid magenta }`, main painted the panel's away leaf red (rgb(255, 0, 0)), gave a margin card's messages a 123px text end, painted lf-code's lines blue (rgb(0, 0, 255)) over its highlight, and outlined lf-tabs' strip and panel, lf-code's scroller and lf-options' "Add another option" field in magenta (4px rgb(255, 0, 255)). The chrome's `all: revert-layer` guard stops a plain declaration but not a custom property, and a widget's parts in the page have no guard at all. Each is now the same name under `data-lf-`, its values unchanged, except where that name already meant something a document-wide reader or an unscoped rule relies on: - the panel view's `data-view` became `data-lf-route`, since prepaint.js sweeps `[data-lf-view]`, a revision's view members; - the panel status's `data-held` became `data-lf-held-lines`, since thread/presentation.js strips `data-lf-held` from every node no thread holds; - an On me item's `data-obligation` became `data-lf-obligation-id`, since obligations/view.js sweeps `data-lf-obligation`, the location mark, and chrome.css gives every `[data-lf-obligation]` a landing margin; - the composer field's `data-scrolls` became `data-lf-overflows`, the name the margin card's transcript already gives the same fact, since reach.js writes `data-lf-scrolls` on that field too. Where the prefixed name was already in use for the same kind of fact on other elements (`data-lf-tone`, `data-lf-state`, `data-lf-open`, `data-lf-unread`, `data-lf-place`, `data-lf-ready`, `data-lf-line`), every selector and query names its element, so the uses share a word without meeting. The video bar's `data-hovered` and `data-keyed`, built from one template, are `data-lf-hovered` and `data-lf-keyed`. The `scroll` class stays the page's: page-authoring.md tells an author to add `class="scroll"` to a custom horizontal scroll box, and `page check` would refuse `data-lf-scroll` in markup. Leaf's own surfaces, and a package module's (module-scroll-and-motion.md now says so, as it already did for `data-lf-track`), wear `data-lf-scroll`, and reach.js and the shared containment rule in controls.css read both. Where the runtime marks an element the page owns (a code block, a part beside the Layout's views, a bounded block's body), the mark joins `RUNTIME_PAINT_ATTRIBUTE`, so a reading of the author's attributes looks past it, as it did past `class`. Kept as they are: the attributes an author writes (`data-width`, `data-height`, `data-bound`, `data-sample*`, `data-annotations`, `data-rail`, and `data-room`, which Leaf's own controls also use, one rule for both), the playground's `data-playground-*` on its host, which the author's preview CSS reads by design, Pierre's attributes on the DOM it renders (`data-line`, `data-line-type`, `data-code`, `data-content`, `data-separator` and the rest), including the ones lf-diff copies onto its own rows and `pre` so Pierre's vocabulary keeps reading them, and the diagram's `data-id`, which pele writes. On the same probe this change shows Leaf's own styling: the away leaf in the theme's warn (rgb(180, 116, 26)), the message's own 13px text end, lf-code's lines unpainted but for the highlight, and no outline on any widget part. Nothing changes on a page that doesn't target the old names, and specificity is unchanged: each `[data-x]` became `[data-lf-x]`, and `:where(.scroll)` became `:where(.scroll, [data-lf-scroll])`. Tests and dev tools read the new names. Attributes a test gives its own fixture, which only share a word with Leaf's, stay: the `data-row` key test_focus.py, focus.test.mjs and an application-boundary widget hand to `holdFocus`, a test widget's `data-words` and `data-ready`, the shift watch test's `data-key` on `body`, the write watch test's `data-for`, and the examples' own `data-state` and `data-status`. The shift and words watches' expected node paths lose the `.scroll` class (`leaf-text#field`, `lf-diff#patch.lf-rendered`), and reach.test.mjs asks a native code block for `data-lf-scroll`. ### Checks - Main is merged in, and with it three new readers of the old names, which now read `data-lf-obligation-id` (the On card selector, `ON_CARD`), `data-lf-key` (the queue walk), `data-lf-event` (undo's message lookup) and `data-lf-number` (a text document's line number, in #5226's lf-text-document code and test). #5249's change bars write theirs as `data-lf-for`, `data-lf-gap` and `data-lf-kind`, the stills drivers that moved to `dev/leaf_dev/states.py` in #5259 read the new names, as do #5263's fold test (`data-lf-says`, `data-lf-rest`) and #5264's dev browser helper (`data-lf-open`). - The pull request's `test` job: its failures outside the journeys fail on main too; of the journeys, `test_the_feature_gallery_exercises_its_core_journeys` failed here because the test read the gallery's own preset buttons as `data-lf-route`, and now reads the author's `data-view`. The pressed-controls sweep's 28 cases, `test_an_aimed_comment_keeps_its_place_with_on_me_open`, and the navigation, controls and website-server journeys that failed fail the same way on main. - `pnpm run check` and `pnpm run test:runtime` (753 pass), pre-commit over the changed files, and the kernel rebuilt with `pnpm run build:browser`. - 67 browser tests, by node id, that read the renamed attributes: the floating panel's status peek, passing notices, versions, menu lists and Threads' New; thread summaries, attempts, failure receipts and message obligations; reactions; the send corner; the shift and words watches' field paths; reach for an authored `.scroll` box; the trace timeline and overview; timeline steps; lf-code excerpts and text-document numbers; the diff's cut path; the call diff; overflowing tabs; On me cards; rings and aim; a board's lifecycle; the recording bar; the smoke tier's three changed tests; and read state. `test_a_pointer_folds_the_panel_from_its_corner` fails the same way on main: the corner button calls `foldPanel` directly, so no `lf-command-invoked` arrives for the test to read. - `leaf-dev stills` over the 61 catalogue states that draw the renamed attributes found no computed style that differs; the style lists only re-key the elements that lost the `scroll` class. Stills differ only where every run differs: About's fingerprint and port, a caret's blink, an overlay scrollbar's fade, and a target trace one arm caught mid-transition, in the other arm on a second run. The stills drivers name the new attributes, so for this comparison 21 states drove the merge base's runtime through a local patch that accepted either name. > _This was written by Claude Code on behalf of max-sixty_
max-sixty
added a commit
that referenced
this pull request
Nov 16, 2026
Pressing a row in the leaf's menu puts the menu away, which paints the empty row, and then runs the row's command, which may paint again. When `z` shows a resolved thread in the panel, the first paint showed the On Me mark and the second hid it, in one task, so the write watch failed `test_z_names_what_it_takes_and_how_long_ago_in_a_fresh_tab` on every main and nightly run. With a page draft in the field, `data-lf-drafted` flipped the same way. `putAwayThen` now holds the row's posture while the press runs: the parts of the row that follow the field and the view over it (the host's writing, draft, offer and press attributes, the leaf's dots and count, and the quick seat). It then paints once, so each is written once per press. The Fold row's bypass from #5263, which avoided the same paint flipping the leaf's error dot, is removed, and Fold goes through `putAwayThen` like every other row. **Why not one transition, as the issue proposed.** I tried deferring the put-away's paint into the command's own transition. The command then ran with the menu still drawn: Align from the menu on touch left the page unscrolled (`test_the_menu_keeps_its_place_when_a_revision_shortens_the_words_it_held`), and two other menu tests gained new unchanged-write findings. Commands need the panel the put-away drew, so only the posture waits. #4760 and #5335 fixed a different cause, a focus move after a paint changing the writing posture, and those fixes stand. **What it leaves.** The hold ends when the command returns. A view a command opens after an `await`, as Undo does for a resolved thread anchored below the fold, still repaints the posture, as on main; the watch doesn't report that case, since the two writes reach it in separate batches. Pressing Search page from the menu's search still hides and re-shows the field's editors, search surface and mode chip in one press, on main as here: the field's occupant goes search, page editor, search, and the command needs that search drawn, so the hold leaves it. **Checks.** `leaf-dev probe --base`, sampling each frame for 800 ms after pressing Undo, Undo over a page draft, Fold with an error pending, and Copy link, shows the same frames on base and head; base writes the quick seat's `hidden` twice in the Undo press and `data-lf-drafted` twice in the draft case, head neither. The failing test, the Fold test (which fails with the old `putAwayThen` and no bypass) and 29 other focused tests on `putAwayThen`'s callers pass, as does `pnpm run check`. Closes #4745 > _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.
The menu's Fold to the leaf row went through
putAwayThen, which closes the menu and then runs the command. Closing the menu painted the open panel with an empty field. When an error about nothing is pending, that field says the error, so the leaf's error dot was removed. The fold then painted the folded panel and put the dot back, all in the same task. The write watch reports that asunchanged write: data-shown on span.lf-fp-error-dot, which is how the nightly stale-key sweep failed on the file-editor example on both Linux and macOS (#5183): its press sequence reaches the Fold row after a failed copy has raised an error.The row now runs the fold command directly, as the
.key already does.setResttakes the view away itself and keeps focus on the leaf, soputAwayThenadded only the intermediate paint. The screen after the press is the same: the panel is folded and the dot is shown. The panel just skips drawing the open state in between. This was latent since the menu's rows and folding took their current shape; a page change reshuffled the sweep onto it.Verification:
test_folding_from_the_menu_draws_the_panel_folded_at_onceraises an error, opens the menu and presses Fold. It fails onmainwith the same write-watch finding and passes with the change.test_presses_and_fills_leave_no_element_naming_stale_keys[file-editor]fails onmainlocally and passes with the change.test_render_floating_panel.py(16 selected),pnpm run test:runtimeandpnpm run check:browser(kernel rebuilt) pass.Closes #5183 — automated triage