Repository navigation
Keep quoted passages visible while commenting - #660
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
Answering the question in the description directly: of the three mechanisms, one holds up, one is inert, and one is the wrong shape.
The initial side choice is the coherent part. initialPlacement asks something Floating UI cannot: whether a horizontal rail exists at the compact minimum, and which vertical side has more reachable room. And because verticalRoom trades visible band for scroll travel one-for-one, its answer is scroll-invariant, so the side really is stable. Keep it.
The Floating UI shift clause is inert. In the vendored bundle, shift clamps the axis perpendicular to the placement under mainAxis — x for top/bottom — and the placement axis under crossAxis. So this clause switches off the horizontal clamp and leaves enabled the vertical one its own comment says must go. Replacing it with the unconditional shift({ ...overflow, mainAxis: true, crossAxis: true }) it replaced leaves all four placement cases in tests/test_render_aim.py passing, which is the evidence that it carries no behavior.
The fixed-side scrolling is where the model breaks. It reads as a one-time reveal but is evaluated as a standing constraint: placeFab is what autoUpdate calls on every ancestor scroll, so the reader's own wheel gesture is corrected away in the next frame. With a grown editor the page stops scrolling in one direction entirely. Reproduction and the merge-base control are inline.
One smaller thing that follows from the first point: the module header still reads "Floating UI owns coordinate conversion, overflow, fallback side, and reflow updates", but the fallback side is now decided in initialPlacement before Floating UI is asked.
test_render_aim.py, test_render_anchors.py, test_render_drafts.py, and test_render_semantic_selection.py are green on the merged tree (269 passed), so the scroll capture is uncovered.
leaf-agent
left a comment
There was a problem hiding this comment.
The shift clause and the module header are both resolved: shift is unconditional again, and the header no longer credits Floating UI with the fallback side.
The scroll capture is narrowed, not closed. heightChanged cannot separate "the reader typed" from "the reader scrolled", because verticalRoom stops being scroll-invariant as soon as the passage begins clipping at the reading boundary: keepClear.height shrinks, boundary.height - keepClear.height - 6 grows, the editor's cap grows with it, and fabBar.offsetHeight therefore changes during a pure wheel gesture. The gate fires and the reveal scrolls the reading region back. Reproduction inline — six identical downward wheel events give 0 -> 150 -> 300 -> 450 -> 600 -> 750 -> 900 -> 479.
That same invariance is what the new comment asserts ("visible room and remaining travel trade one-for-one") and what justifies dropping keepClear.top and keepClear.bottom from placementInput. It holds only while keepClear is the unclipped rect, which is the regime the tests stay inside.
The two new wheel assertions do hold, but they stop several hundred pixels short of the clipping regime, so the surviving capture is uncovered. A signal keyed to the field's content rather than to its placed height would fire once per commit and stay still under scroll.
leaf-agent
left a comment
There was a problem hiding this comment.
The scroll capture is closed: fabInput.scrollHeight holds at 739px across a full wheel gesture through the clipping regime, so the gate stays quiet and the reader reaches the end of the page. At 73d5a4d the same gesture oscillated 767 -> 617 -> 917 -> 767 and never passed 917.
What clipping still moves is the editor's own cap. verticalRoom reads keepClear, the clipped union, so boundary.height - keepClear.height - 6 grows as the passage leaves the reading boundary and then collapses when the passage leaves entirely and keepClear falls back to the unclipped shownBox. Measured at 390x900, placement top-end, a 435px passage and a 739px draft, wheeling down to the end of the page: --lf-float-h runs 376 -> 312 -> 383 -> 683 -> 312 while the draft's content height never changes. The 683 -> 312 step takes 371px of the reader's own draft back behind the internal scroller at the moment the passage is furthest off screen — the frame with the most room to give is the one that gives the least.
That is also the invariant the comment above placementInput states. "Visible room and remaining travel trade one-for-one" is exactly true of the block's unclipped rect — blockTop - boundary.top - 6 + scrollTop is constant in it — and false of keepClear, which is what carries the cache key's remaining keepClear.left/keepClear.right and the dropped keepClear.top/keepClear.bottom. Reading the room off union(parts.map(shownBox)) instead holds --lf-float-h at 312px across the same gesture, leaves the scroll free, and keeps all 56 cases in tests/test_render_aim.py green — which is why the new coverage does not reach this: both readings pass it.
leaf-agent
left a comment
There was a problem hiding this comment.
Both findings are closed, and the placement model now reads as the single rule the description claims. Approving.
The three mechanisms are no longer overlapping. initialPlacement answers what Floating UI cannot — whether a horizontal rail exists at the compact minimum, and which vertical side has more reachable room — and answers it once. flip is initial-only and now takes its fallbacks from that choice rather than a fixed list, so it orders the same preference instead of competing with it. shift is unconditional again, so nothing in the middleware stack second-guesses the side. The reveal is the one piece that moves the reader, it is gated on intrinsic content height, and with the cap scroll-invariant it can no longer re-enter on its own scroll.
The reading split is the part that makes it coherent: roomRect (unclipped) decides room and the cap, keepClear (clipped) is the attachment reference and the horizontal rail. Room is a property of the block; attachment is a property of what is on screen.
Verification
Regression keyed to the defect: the new test_a_text_comment_chooses_above_when_the_page_has_more_room_there run against 1859d64f's runtime fails on the first wheel step past the clipping boundary (--lf-float-h 502.3 -> 650.3) and passes at feeb609f.
Review selection at the PR head — the response surface's own file plus the two other surfaces that place against it: tests/test_render_aim.py tests/test_render_drafts.py tests/test_render_reactions.py --run-nightly, 189 passed. CI's test and lint are green on this head.
…ruled out (#768) The cutover list scored its candidates from a survey's estimates. Six of the rows ranked next were measured against the code, and every one was stale or overstated; an independent review then confirmed the six verdicts and corrected three of the reasons behind them. The rows now carry what was measured, and the ones the measurements ruled out have moved to the survey note, whose table is now named Rejected. What the measurements found: - **`html` as the page scroller** was already done: `26feec8b` made the switch on 2026-08-29, `theme.css` holds the rule, and the runtime reads `document.scrollingElement`. The row is gone. - **Same-document View Transitions** claimed ~150 lines against a `motion.js` of 87. The update applies after the old state is captured, later than the gesture's own turn; pointer input misses the page while it animates; a fold collapses height so later content slides, which a root cross-fade does not draw; and board cards move inside their own scroller, whose clip a snapshot escapes under the Chrome 125 floor. #666 removed the paint-boundary transition version travel used, which also leaves `theme.css`'s `lf-versioning` rule dead — deleted here. - **idiomorph for the version patch**: a live-tree diff keeps only the reader state an exclusion names, while `dom-children.js` compares authored source with authored source and keeps all of it. It has needed no fix since #514 split it out. - **`tsc --checkJs`** runs in under a second, but a bug-back over six runtime fixes (#404, #448, #625, #660, #676, #757) found no error that the fix removed from the files it touched, and the errors it does report are inference artifacts. - **Browser-owned anchoring** was spiked on `agent-a4111d25e33d466d2`. All three capture paths cut over and the anchors matched the Python capture exactly, but Python grew by 168 lines, a quoted `leaf comment` went from 0.2 s to 1.3 s and now needs Chrome, and the anchor tests went from 8 s to 37 s: the refusals and the diagnostics for a quote the page does not show read authored source the rendered page no longer holds. - **The user-level daemon** nets roughly zero lines. The browser already receives pushes over `EventSource`, the 70 µs stat loop serves CLI writers in other processes, pid probing and most locks stay, Windows is not a goal, and a user-level database stops the page directory being the deployment unit. Two rows are new. A size-first sweep of the largest hand-written mechanisms found one candidate the defect-led survey missed: serving each page through starlette and uvicorn, which `mcp` already installs, keeping one process per page. And the keyboard system becomes item #24 under architecture simplification: the reader keeps every key, sequence, hint, and the one-press-per-layer Escape, while the code that infers which surfaces are open — where ten of the last 24 keyboard fixes landed — gives way to a layer stack that openers push and closes pop. No library owns that; the ones that came closest are in Rejected. The preamble now says effort and confidence are estimates unless a row cites a measurement. Checks: the everyday suite (1,135) and `test_a_revision_navigates_without_the_view_transition_api`, which exercises activation with the View Transition API switched off, both pass; pre-commit is green on the changed files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
A growing floating text comment could cover the passage it quoted even when the reading region had enough scroll travel to show both. When neither horizontal rail fits, this change chooses above or below from the visible room plus reachable scroll travel, keeps that side while the editor grows, and moves the owning reading region only enough to preserve both the passage and the field. The unclipped block decides available room while its clipped part remains the attachment reference. Reveal runs only when the editor's intrinsic content height changes, so later wheel and touch gestures retain their ordinary navigation meaning even as clipping changes the placed geometry. Comments on whole elements retain their existing viewport-overlay behavior.
Please review the placement model from scratch for simplicity. In particular, reject this if the initial side choice, fixed-side scrolling, and Floating UI middleware are overlapping mechanisms or patches on earlier complexity. The intended model is one coherent rule: choose a viable side once, move the existing reading scroller only as needed, then cap the editor when both cannot fit.
Verified with the complete 1,043-test suite, the 200-test focused nightly browser selection, and all pre-commit checks. The browser tests exercise settled wheel scrolling in both vertical placements after the automatic reveal and carry the above-placement case through passage clipping to the document limit while asserting a stable height cap. Direct pointer selection at 671 x 578 also keeps the same multiline draft and quoted passage visible together, with clean browser consoles.