Repository navigation
Stand floating surfaces in the plane of the edge that holds them - #1782
Merged
Merged
Conversation
A thread card beside an element stood level with the element's top as the window clipped it. Once that top scrolled above the window, the clipped top was the viewport's edge, so the card sat at y=0 under the banner in the page's plane: anchored to the element, carried by each scroll frame, and placed back by the next placement. Shift+a up to an Ask with a thread showed this as a shaking card, and so did any scroll through a tall commented element. Beside an element, the card now stands level with any line from the element's unclipped top (`row`) to its foot (`lastRow`). While the top is scrolled away and the rest shows, the boundary holds the card at the window's top below the banner, in the window's plane, so the scroll writes nothing; it leaves with the element's foot. A passage's card still goes with its first line. Behavior change: the card on a partly scrolled element waits below the banner instead of under it, and leaves with the element's foot rather than vanishing when the last pixel leaves the window. The comment box shares the rule. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The thread card, comment box and Ask option badges keep a scroll from writing to them by standing in the plane that carries them: anchored to their subject, or fixed to the window. The plane was guessed from where the box landed, so a box positioned by one scrolling box could be anchored to another, carried by each scroll frame and placed back. - comment-placement's `plane` reports what bound the answer: the rule's line, or the boundary edge it was shifted against. floating.js resolves that edge to its holder (`holderOf`), the innermost scroller or reading region around the subject with that edge, and anchors the box to it in a new `region` plane; no holder leaves it in the window's plane. `heldByWindow` is gone. - A boundary carries the `key` that holds its side: the window's edges, or a region's whole size and the window's, so a page scroll that moves a pane's shown bounds no longer flips the card. - The card's region clip comes from the solve (`clientBox`), not a read of a box that may not be laid out yet, and stops at the card's paint reach. - A binding badge the banner holds in is fixed (`placeChip`'s `held`). Behavior change: a card held in by a pane's edge stays still while the pane scrolls, and keeps its side through a page scroll. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # skills/leaf/packages/default/runtime/annotation-overlay/comment-placement.js # skills/leaf/packages/default/runtime/annotation-overlay/margin-projection.js # tests/runtime/comment-placement.test.mjs
leaf-agent
previously approved these changes
Oct 5, 2026
# Conflicts: # skills/leaf/packages/default/runtime/annotation-overlay/comment-placement.js # tests/runtime/comment-placement.test.mjs
leaf-agent
approved these changes
Oct 5, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 6, 2026
The target trace, the aim and the visual marks were drawn in the document's plane from the target's box as each pane clipped it, so every scroll of a pane holding the target rewrote their position and clip, a frame behind the words. They now move with every scroll around their target without script, the way #1782 made the thread card do. ## Paint stands Each paint box stands in a paint stand (`runtime/target-paint-geometry.js`, `paintStand`): one frame per box that clips the target, cut to that box's band, inside the frame of the box holding it. `geometry.js` `paintClips` reads those bands from the existing clip walk, which `clipped` and `pagePlaneRect` now share through `clipWalk` and `cutBy`. Each frame is moved by the scroll of the box holding it through native motion layers (new `runtime/scroll-motion.js`). Lengths are written where they stand at their scrollers' start, so placing the paint again after a scroll writes nothing. A header stuck over the page's top cuts the paint in the window's plane, as a fixed frame round the page's motion. The thread panel and drawers cut only paint stacked above them (`data-lf-paint-plane="chrome"`), since they hide what stacks under them. A stand whose box is put away drops its frames and timelines. ## Motion layers Each motion layer runs on a ViewTimeline of the box its scroller holds next (the next frame's box, or the target), so content growing elsewhere in a scroller leaves the paint on its target. Two cases keep the scroller's ScrollTimeline: words standing directly in a scroller, and an axis a scroller starts at its far end (right to left, vertical writing modes, reversed flex), where Chrome measures a ViewTimeline's range from the wrong end. The axis's direction comes from computed style. `floating.js`'s motion layers move onto the same helper and gain both, with the right sign for those axes. Where the browser has no scroll timelines, as Firefox has none, the axes are listed without one and the box is placed again on each scroll. ## Visible change A contour whose target is partly scrolled out of a pane is now cut open at the pane's edge, as the target is, instead of closing along the pane's edge. `leaf-dev stills` gained a state for it (`sort-aim-cut`); it is the only state that changed. ## Tooling and instructions - `leaf-dev stills` captures at two device pixels per CSS pixel, so crops show text and hairlines as the reader's display draws them. - `/developing-leaf`: a visible change's before/after pairs are handed over on a Leaf page, an `lf-shot` for each difference from the stills crops, rather than "embedded in the reply", which a terminal session cannot do. It keeps #1861's rule to show each difference once. ## Tests - `test_the_paint_over_a_target_in_panes_rides_each_panes_scroll`: no writes to the paint on either nested pane's scroll, the paint stays on its element, and stays there when content grows below it. It fails on main. - `test_a_comment_box_on_words_in_a_scroller_stands_without_scroll_timelines`: with no scroll timelines, the comment box for words in a scroller stands and holds its place; it threw before. - Two aim tests that measured the paint box's own rect for a clip now read the part its frames show. - `npm run test:runtime` passes. Before the merge with main, the margin, aim, drawing, reactions, anchors, navigation, controls, pages, widgets, shift-watch and send-placement files and the gate's scroll-writes and at-rest checks ran with 15 failures and 5 errors, all of which fail the same way without this change. ## Still open - A thread card in the page's plane that a pane's edge cuts still rewrites its clip on each pane scroll; the stand's frames could carry that clip. - Paint over a sticky target inside a scroller still trails and is rewritten on scroll. - `lf-shot`'s change reading outlines the whole pane for this one-line change, since the removed line touches the pane's border. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
added a commit
that referenced
this pull request
Oct 9, 2026
The bracket variant of the margin card plane test in [main CI run 37890564846](https://github.com/max-sixty/leaf/actions/runs/37890564846) never reached the position it claimed to check. Its scripted scroll moved the document temporarily, but the runtime restored the focused Ask into view. At the final assertion the bracket still extended below the window top, so expecting the card to switch to the page plane was premature. The fixture now leaves room after its last Ask, and the test uses a wheel gesture to establish reader scroll intent. It explicitly checks that the target's foot passed the window top before checking the card's page plane. The bracket variant failed and the mounts variant passed before this change; both pass after it on current `main`. This preserves the card placement behavior introduced in [#1782](#1782). Co-authored-by: leaf-agent <[email protected]>
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.
Pressing Shift+a to go up to an Ask with a thread made the thread's card shake as the page scrolled. Leaf keeps a scroll from writing to its floating surfaces by putting each box in the plane of whatever carries it. A box in the page's plane is anchored to its subject, so the browser moves it. A box in the window's plane is fixed. The card shook because it was positioned by one scrolling box and anchored to another: each scroll frame carried it, and the next placement pulled it back. This change makes the plane follow from the constraint that actually positions the box, and fixes the same mismatch in three more places.
The Shift+a card
commentAttachmentread the card's line from the element's top as the window clipped it, which is just the window's edge once the top has scrolled away. The card sat at y=0 under the banner, anchored to the Ask. Beside an element, the card now stands level with any line from the element's unclipped top (row) to its foot (lastRow). While the top is scrolled away and the rest still shows, the boundary holds the card just below the banner, in the window's plane, and the card leaves with the element's foot. A card on quoted words still follows the quote's first line. The comment box uses the same rule.The plane comes from the binding edge
commentPlacement().planeused to guess the plane from where the box landed (heldByWindow, a pixel comparison with the window's edges). It now reports what bound the answer:"page"where the rule's line holds the box, or the edge the boundary shifted it against.floatingPlacement.positionresolves that edge to its holder (holderOf): the innermost scroller or reading-region body around the subject whose edge lies on that line. A box held by such an edge stands in a newregionplane, anchored to that box, which the outer scrolls carry and the region's own scroll does not. When no scroller or region has that edge, the window or banner holds the box and it stands in the window's plane.boundary.key: the window's edges, or the region's whole size together with the window's. A page scroll moves and clips a pane's visible bounds, and that used to flip the card from under the element to over it.clientBox), not read back from the card, which can still be at its pre-scroll spot. It also stops at the card's paint reach, its shadow, so an edge the card is nowhere near gives a constant clip.Ask option badges
An Ask option's binding badge is pulled down below the banner while its control's top is under it. The badge sat in a layer the document scroll carries, so each scroll frame carried it and the next pass put it back. A badge held by that edge is now
position: fixed(placeChip'sheld).boxAtreads it back in its layer's coordinates.Still open
holderOfmatches the holding edge to a scroller by position. Where a scroller's edge happens to lie on the banner's foot, the card takes that scroller's plane until they part, usually for one frame. Acontain: paintclip is not a scroller, so a card it holds stands in the window's plane.Tests
test_a_card_beside_an_element_scrolled_past_its_top_waits_at_the_windows_top, for a section and for an Ask's options, which carry badges.test_a_card_a_panes_edge_holds_stays_put_as_the_pane_scrolls, covering the pane's own scroll and a page scroll.test_a_card_an_outer_panes_edge_holds_stands_in_that_panes_plane.tests/runtime/comment-placement.test.mjsbuilds keyed boundaries and checks that a page scroll keeps a region's side.tests/shift_watch.jspredicts a plane change from the selection's frame box.Each new browser case fails on main. In the browser files the change touches (margin, send placement, anchors, shift watch, and the badge and pane cases elsewhere), 22 tests fail, and all 22 fail the same way with main's runtime: 19 in
test_render_anchors.py, two intest_render_navigation.py, one intest_render_widgets.py.