Skip to content

Guard the floating editor's dropped scroll padding with a test that fails without it - #5589

Merged
max-sixty merged 3 commits into
mainfrom
grind/caret-reveal-guard
Nov 6, 2026
Merged

max-sixty merged 3 commits into
mainfrom
grind/caret-reveal-guard

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

While the user writes in a floating comment box, the root drops its scroll padding (data-lf-floating-editor, browser/base.css), because the browser's caret reveal through a box anchored to the page applies that padding and moves the words beneath a box already in view (#4821). Nothing in the suite failed with that rule removed: #4833's test_a_card_at_the_windows_foot_grows_back_to_how_it_stood stands its card in the window plane, which writes no position-anchor, so the reveal stops at the box there. This adds a test that does fail, and records why the rule has no structural replacement.

  • Test. test_writing_in_a_comment_box_over_the_window_foot_moves_no_words (tests/browser/test_chrome_contracts.py, Chromium and WebKit) opens a comment box on words low in a 1512×860 window, so the box stands over the foot band the panel states, types four letters, and asserts the page didn't scroll. It also asserts the caret stands inside that band, so a layout change that moves the box clear of it fails the test rather than passing it vacuously. With the rule's declaration removed, the words move 16 px in Chromium 156 and 14–21 px in WebKit 27.2.
  • Why the rule stays. Chromium stops a scroll-into-view at a fixed box only when the box has no anchor scroll adjustment (IsFixedToFrame, scroll_into_view_util.cc); since crbug.com/469481151 an anchored fixed box bubbles to the root and takes its padding, pinned by WPT css-anchor-position/scroll-to-anchored-fixed-001…006. WebKit does the same (adjustForScrollByAnchor, LocalFrameView.cpp). Firefox 157 reveals nothing through a fixed box. An agent tried, on a plain anchored contenteditable and in Leaf: the field or the box as its own scroller, overflow, contain, overscroll-behavior, the top layer (popover), position: absolute, scroll-margin on the caret's text, and taking typing in beforeinput. Each either still moved the page in Chromium or WebKit, or stopped the box following its anchor. The comments in base.css and floating.js now name WebKit and say what was rejected.
  • Engine note. notes/browser-support.md records a Chromium bug found on the way: each reveal of an anchored fixed box made before the next frame scrolls the full amount again (three scrollIntoView calls scroll 270 px where one scrolls 90; four keys in one frame 240 px where one scrolls 60). WebKit reveals once. It is the overshoot Keep landings clear of the chrome while a floating editor holds focus #5417 accepted, and the note gives the check that shows when Chromium fixes it.
  • The rule's comment now names leaf-dev bench, which replaced leaf-dev scaling in Measure every page and input with one leaf-dev bench, in place of scaling and bench-latency #5576.

Checked: the new test passes on both engines at the head and fails on both with the rule's declaration removed (Chromium 2076 → 2092, WebKit 2075 → 2096, rerun independently); #5580's restyle test passes; pre-commit on the changed files.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 3 commits November 5, 2026 18:19
…ll matters

The root drops its scroll padding while the user writes in a floating box
(base.css, data-lf-floating-editor), because Chromium and WebKit reveal a
caret in a box anchored to the page by scrolling the page and count that
padding. The test #4833 left for it,
test_a_card_at_the_windows_foot_grows_back_to_how_it_stood, now passes with
the rule removed: its card stands in the window's plane, which names no
position-anchor, and both engines stop a reveal at a fixed box with no
anchor. #5580's test proves the toggle restyles only the chrome, not that
it keeps the words still. So nothing failed without the rule.

The new test types into a comment box standing over the panel's band at the
window's foot. With the rule removed it fails in Chromium 156 (the words
move 16 px) and WebKit 27.2 (14 px); with the rule as a plain zero and in
the calc(0 * var(--lf-landing-top)) form #5580 landed, it passes in both.

The browser-support note records a Chromium gap found on the way: reveals
of an anchored fixed box made before the next frame each scroll the full
amount again (three scrollIntoView calls scroll 270 px rather than 90),
which is the overshoot #5417 accepted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o, and why nothing else does

The rule's comments named Chromium alone. Playwright WebKit 27.2 moves the
document under a comment box at the window's foot as Chromium 156 does (14
and 16 px for one key; 58 and 221 px over a growing comment), and the rule
keeps both still; Firefox 157 reveals no caret through a fixed box.

The comment now records the alternatives measured against a plain anchored
contenteditable and in Leaf's own boxes, all of which left the reveal
reaching the page in Chromium, WebKit or both: the field or the box as its
own scroll container, overflow clip, contain (layout paint; strict only
stopped the box following its anchor), overscroll-behavior, a popover in
the top layer, scroll-margin on the caret's text (Chromium honors it,
WebKit applies none to a caret's reveal), and taking typing in beforeinput
(WebKit still reveals). Both engines reveal through the box's anchor by
design: Blink's IsFixedToFrame skips a box with an anchor scroll adjustment
(crbug.com/469481151, WPT css-anchor-position/scroll-to-anchored-fixed-*),
and WebKit's adjustForScrollByAnchor does the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rd test's docstring to what it holds

#5576 replaced `leaf-dev scaling` with `leaf-dev bench`, so base.css now
names the command the 256-section asks page comes from.

The guard test's docstring states the box over the foot band, the engines'
reveal counting the padding, and the rule it guards. How the failure was
found stays here: with the rule's declaration replaced by a comment, typing
four keys into that box moved the words 16 px in Chromium 156 and 14 px in
WebKit 27.2 (21 px in WebKit when both engines ran at once), and each line
that grew the box further down the window moved them again (221 px and 58 px
over fourteen lines from words 500 px down an 860 px window). Firefox 157
reveals no caret through a fixed box.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@max-sixty
max-sixty merged commit 146189c into main Nov 6, 2026
5 checks passed
@max-sixty
max-sixty deleted the grind/caret-reveal-guard branch November 6, 2026 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants