You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Typing in a pointed reply brings its field above the window #4751
In tests/browser/test_render_aim.py::test_a_pointed_cards_reply_brings_the_pointed_row_back, scrolling first carries the reply below y=900, then typing here leaves it at x=1102, y=-124.296875, width=292, height=40 after settlement. The viewport containment assertion fails. This was left unowned by the previous #3985 diagnosis; current-main reproduction is still needed. The earlier #4401 words-watch diagnostic does not establish the same mechanism.
This report session read CI evidence and did not reproduce locally. Reproduce on current main and read the introducing change and previous results before choosing a repair; preserve its intent and the user behavior. A passing rerun alone does not settle an intermittent failure.
This remains an unresolved intermittent failure; I have not established a repair and am leaving the issue open. The reported test passes both on current main and on the original failing revision, so the passing results cannot identify a fixing commit.
I checked the original run's assertion and screenshot: the viewport assertion places the reply above the window, and the card is absent from the captured viewport. The next diagnostic step is to record the ordering of the off-flow surface's before-edit landing, the input handler's instant reveal, and subsequent card placement, then hold/release the conflicting operation to make a deterministic reproduction. Those two reveal paths exist at the failing revision; their involvement in this failure is still unproven. This remains engineering work tracked here, without a maintainer decision needed.
Reproduction attempts and evidence
Original evidence: run 40683296920, commit 63b2e3e8d132f7abfe2201dd4ca55558bcffa0a7. Its JUnit result fails the viewport assertion at y=-124.296875, height=40; its screenshot shows the card offscreen.
The same node passes locally on that revision at 6× and 20× CPU slowdown. Scratch variants with 16, 80 and 250 ms between the final characters also pass.
On main at 55ce1ef021071c8d81decaf2edf9e2307e5432a2, the unchanged test passes at normal speed, 6× and 20× slowdown. All 18 concurrent copies at 6× slowdown pass as well.
Run 41020623753, at d831e8a3c0dab56fe18b3c4f54d4c2c8124eee2b, records this node passing in its JUnit artifact, despite the overall run failing elsewhere.
Commands: uv run pytest tests/browser/test_render_aim.py::test_a_pointed_cards_reply_brings_the_pointed_row_back -q -n0, with --cpu-throttle 6 and --cpu-throttle 20; concurrent sampling uses uv run leaf-dev flake with that node and --cpu-throttle 6.
No production code or committed tests changed. These results do not establish a shared cause with #4401 or resolution by #4761.
The two reveal paths do overlap on current main, but I have not reproduced the above-window result or established a repair. This remains open engineering work.
At e6ad6624f2f02db20ec50a5cfd6b63bbd0f2375e, the unchanged test passes at 6× CPU slowdown. A temporary traced copy also passes at 20×. The trace narrows the next experiment: hold card placement across successive editing events, then release it, rather than adding more slowdown samples. That would test whether another reveal reads an old fixed-surface position after the document has already moved.
Observed reveal ordering at 20× slowdown
I recorded keydown, beforeinput, lf-before-edit, input, and scroll in capture listeners, plus calls to Element.prototype.scrollTo with the native method still executing immediately. Each reading included scrollY, the reply's bounding rectangle, the requested options and the call stack.
For the first character after the deliberate −700px scroll:
Before editing: document scroll 1148px; reply y=1056.515625px.
The before-edit path requests document top 1459.703125 with behavior: "smooth".
The input path requests the same top with behavior: "instant", while the reply still reads y=1056.515625px.
A later scroll event reads document scroll 1724px while the reply still reads y=1056.515625px.
Before the next keydown, placement has brought the reply to y=610.515625px. It stays there through the remaining characters and passes the viewport assertion.
Both document scroll requests run through setScroll → land → scrollIntoReadingBand → scrollIntoView. This records overlapping reveals and delayed card placement; it does not establish what caused the additional document movement or the original negative-y failure. No product code or committed tests changed.
Baseline command: uv run pytest tests/browser/test_render_aim.py::test_a_pointed_cards_reply_brings_the_pointed_row_back -q -n0 --cpu-throttle 6. The traced copy used the same test body and --cpu-throttle 20.
Cause found; no fix yet. Chromium's native caret reveal reads a stale card position when several keystrokes land before the next frame, and each of those keystrokes scrolls the document again. A standalone Chromium 156 page reproduces it deterministically. The Leaf test only shows it when frames lag, which is why it passes locally and failed once in CI.
Mechanism. The thread card is position: fixed and placed with position-anchor/anchor(). After a document scroll, Chromium leaves an anchored box's rectangle where it was until the next frame updates its anchor snapshot. annotation-chrome.css already records that Chromium carries the native caret reveal through such a box to the document. The reveal measures from the same stale rectangle. So when a trusted input arrives while the card still reads as being below the window, Chromium scrolls the document to bring the caret into view. The card stays where it was until a frame runs, so the next keystroke sees the same stale position and scrolls again.
The CI number matches. In this test each stale keystroke adds 180px. The single-reveal end state is y≈778; five reveals take it to 778 − 5×180 ≈ −122, close to the reported −124.3. That fits all five characters of here landing before any frame.
Why the existing mitigation doesn't cover it.#4833's scroll-padding: 0 override shrinks the reveal's padding, but here the caret really does read as offscreen, so the reveal still scrolls. #5182 tracks the other cost of that override. Both issues come down to one problem: Chromium's native reveal moves the document under a floating, anchored editor. A repair at that level could remove the override as well as this overshoot. One option is a reply field that inserts text itself (handling beforeinput), so Chromium has no edit of its own to reveal. Leaf's own reveal (revealWritingArea) brings back the in-flow entry, so repeated stale readings don't add to it: in the trace it scrolled the document once. Since that changes how every reply field takes typing, I'm not proposing it as a CI repair without a maintainer's say.
Evidence and reproduction
Leaf trace (current main dc27bd09e, the test with the window's scrollTo/scrollBy/scroll, Element.scrollTop, scrollIntoView and focus instrumented). First character after the −700px scroll:
keydown → beforeinput → Leaf's untrusted input → setScroll to 1375.7 via bringBack → trusted input at 1376 (card still reads y=1056.5) → scroll event at 1556. No script call accounts for 1376 → 1556.
In repeated runs of the unchanged path, the final scroll is 1556, 1736 or 1916 (card at 778, 598 or 418), depending on how many keystrokes beat a frame. At 40× CPU slowdown it is always 1556, because frames then run between keystrokes. That is why throttling never reproduced this.
Disabling scroll anchoring (overflow-anchor: none) does not change it.
Standalone Chromium 156.0.8078.4 page: a fixed contenteditable anchored with position-anchor to an in-flow element at viewport y=1000, in a 900px window, focused with preventScroll. Five characters are sent with Input.dispatchKeyEvent:
keys
input handler scrolls +228 when offscreen
final scrollY
card y
50 ms apart
no
1017
883
pipelined (one asyncio.gather)
no
1485
415
50 ms apart
yes
1245
655
pipelined
yes
2625
−725
In the pipelined runs, every input handler reads the card at y=1000, unchanged by the scrolls before it. A plain fixed editable at the same place, without the anchor, made no document scroll with its keystrokes 50 ms apart.
The Leaf trace is reproducible with the unchanged test plus the instrumentation above. In the sync harness, the deterministic form needs the keystrokes pipelined, which the sync Playwright API can't do, so I haven't added a reproduction PR. No product code or committed tests changed.
Max's decision from the backlog triage: go ahead with this repair.
Repair: Keep native text editing in reply fields, fix #5182 narrowly (landings read the panel's band from declared properties), and accept the rare overshoot when several keys land in one frame.
What decides it:browser/AGENTS.md, “The browser answers first”: taking over text insertion puts IME, undo and spellcheck at risk to fix a case that needs several keystrokes inside one frame.
This was written by Claude Code on behalf of max-sixty
The narrow repair is in #5417. Leaf's landings now read the root's band from --lf-landing-top / --lf-landing-bottom, while the floating-editor override zeroes only the scroll-padding the browser's caret reveal reads. Reply fields keep native editing, and the multi-keystroke-per-frame overshoot stays accepted, as you decided.
It also restores #4833's top-edge override, which #5389's !important in lf-base had been outweighing. With the override restored, [combined-selection] fails without the geometry.js change, exactly as #5182 reported, and passes with it.
Activity
leaf-agent commentedon Oct 30, 2026
This remains an unresolved intermittent failure; I have not established a repair and am leaving the issue open. The reported test passes both on current main and on the original failing revision, so the passing results cannot identify a fixing commit.
I checked the original run's assertion and screenshot: the viewport assertion places the reply above the window, and the card is absent from the captured viewport. The next diagnostic step is to record the ordering of the off-flow surface's before-edit landing, the input handler's instant reveal, and subsequent card placement, then hold/release the conflicting operation to make a deterministic reproduction. Those two reveal paths exist at the failing revision; their involvement in this failure is still unproven. This remains engineering work tracked here, without a maintainer decision needed.
Reproduction attempts and evidence
63b2e3e8d132f7abfe2201dd4ca55558bcffa0a7. Its JUnit result fails the viewport assertion at y=-124.296875, height=40; its screenshot shows the card offscreen.55ce1ef021071c8d81decaf2edf9e2307e5432a2, the unchanged test passes at normal speed, 6× and 20× slowdown. All 18 concurrent copies at 6× slowdown pass as well.d831e8a3c0dab56fe18b3c4f54d4c2c8124eee2b, records this node passing in its JUnit artifact, despite the overall run failing elsewhere.Commands:
uv run pytest tests/browser/test_render_aim.py::test_a_pointed_cards_reply_brings_the_pointed_row_back -q -n0, with--cpu-throttle 6and--cpu-throttle 20; concurrent sampling usesuv run leaf-dev flakewith that node and--cpu-throttle 6.No production code or committed tests changed. These results do not establish a shared cause with #4401 or resolution by #4761.
leaf-agent commentedon Oct 31, 2026
The two reveal paths do overlap on current main, but I have not reproduced the above-window result or established a repair. This remains open engineering work.
At
e6ad6624f2f02db20ec50a5cfd6b63bbd0f2375e, the unchanged test passes at 6× CPU slowdown. A temporary traced copy also passes at 20×. The trace narrows the next experiment: hold card placement across successive editing events, then release it, rather than adding more slowdown samples. That would test whether another reveal reads an old fixed-surface position after the document has already moved.Observed reveal ordering at 20× slowdown
I recorded
keydown,beforeinput,lf-before-edit,input, andscrollin capture listeners, plus calls toElement.prototype.scrollTowith the native method still executing immediately. Each reading includedscrollY, the reply's bounding rectangle, the requested options and the call stack.For the first character after the deliberate −700px scroll:
behavior: "smooth".behavior: "instant", while the reply still reads y=1056.515625px.Both document scroll requests run through
setScroll→land→scrollIntoReadingBand→scrollIntoView. This records overlapping reveals and delayed card placement; it does not establish what caused the additional document movement or the original negative-y failure. No product code or committed tests changed.Baseline command:
uv run pytest tests/browser/test_render_aim.py::test_a_pointed_cards_reply_brings_the_pointed_row_back -q -n0 --cpu-throttle 6. The traced copy used the same test body and--cpu-throttle 20.leaf-agent commentedon Nov 4, 2026
Cause found; no fix yet. Chromium's native caret reveal reads a stale card position when several keystrokes land before the next frame, and each of those keystrokes scrolls the document again. A standalone Chromium 156 page reproduces it deterministically. The Leaf test only shows it when frames lag, which is why it passes locally and failed once in CI.
Mechanism. The thread card is
position: fixedand placed withposition-anchor/anchor(). After a document scroll, Chromium leaves an anchored box's rectangle where it was until the next frame updates its anchor snapshot.annotation-chrome.cssalready records that Chromium carries the native caret reveal through such a box to the document. The reveal measures from the same stale rectangle. So when a trustedinputarrives while the card still reads as being below the window, Chromium scrolls the document to bring the caret into view. The card stays where it was until a frame runs, so the next keystroke sees the same stale position and scrolls again.The CI number matches. In this test each stale keystroke adds 180px. The single-reveal end state is y≈778; five reveals take it to 778 − 5×180 ≈ −122, close to the reported −124.3. That fits all five characters of
herelanding before any frame.Why the existing mitigation doesn't cover it. #4833's
scroll-padding: 0override shrinks the reveal's padding, but here the caret really does read as offscreen, so the reveal still scrolls. #5182 tracks the other cost of that override. Both issues come down to one problem: Chromium's native reveal moves the document under a floating, anchored editor. A repair at that level could remove the override as well as this overshoot. One option is a reply field that inserts text itself (handlingbeforeinput), so Chromium has no edit of its own to reveal. Leaf's own reveal (revealWritingArea) brings back the in-flow entry, so repeated stale readings don't add to it: in the trace it scrolled the document once. Since that changes how every reply field takes typing, I'm not proposing it as a CI repair without a maintainer's say.Evidence and reproduction
Leaf trace (current main
dc27bd09e, the test with the window'sscrollTo/scrollBy/scroll,Element.scrollTop,scrollIntoViewandfocusinstrumented). First character after the −700px scroll:keydown→beforeinput→ Leaf's untrustedinput→setScrollto 1375.7 viabringBack→ trustedinputat 1376 (card still reads y=1056.5) →scrollevent at 1556. No script call accounts for 1376 → 1556.overflow-anchor: none) does not change it.Standalone Chromium 156.0.8078.4 page: a fixed
contenteditableanchored withposition-anchorto an in-flow element at viewport y=1000, in a 900px window, focused withpreventScroll. Five characters are sent withInput.dispatchKeyEvent:asyncio.gather)In the pipelined runs, every
inputhandler reads the card at y=1000, unchanged by the scrolls before it. A plain fixed editable at the same place, without the anchor, made no document scroll with its keystrokes 50 ms apart.The Leaf trace is reproducible with the unchanged test plus the instrumentation above. In the sync harness, the deterministic form needs the keystrokes pipelined, which the sync Playwright API can't do, so I haven't added a reproduction PR. No product code or committed tests changed.
max-sixty commentedon Nov 5, 2026
Max's decision from the backlog triage: go ahead with this repair.
Repair: Keep native text editing in reply fields, fix #5182 narrowly (landings read the panel's band from declared properties), and accept the rare overshoot when several keys land in one frame.
What decides it:
browser/AGENTS.md, “The browser answers first”: taking over text insertion puts IME, undo and spellcheck at risk to fix a case that needs several keystrokes inside one frame.leaf-agent commentedon Nov 5, 2026
The narrow repair is in #5417. Leaf's landings now read the root's band from
--lf-landing-top/--lf-landing-bottom, while the floating-editor override zeroes only thescroll-paddingthe browser's caret reveal reads. Reply fields keep native editing, and the multi-keystroke-per-frame overshoot stays accepted, as you decided.It also restores #4833's top-edge override, which #5389's
!importantinlf-basehad been outweighing. With the override restored,[combined-selection]fails without thegeometry.jschange, exactly as #5182 reported, and passes with it.