Skip to content

fix: hide the margin card transcript's scrollbar while its turns fit as laid out - #6613

Merged
leaf-agent merged 4 commits into
mainfrom
fix/issue-6611
Nov 21, 2026
Merged

leaf-agent merged 4 commits into
mainfrom
fix/issue-6611

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

On a host whose scrollbars take room, the native bar on the margin card's transcript no longer shows while an arriving answer's motion runs. Before this change, an answer at a wrap boundary rewrapped a line taller for the length of that motion, so the card rose a line and dropped back. The bar now shows only where the turns overflow as layout stands them, so the card's top moves only toward where it comes to rest.

Cause. The motion draws the transcript's turns below where they stand (box-motion.js, streamContent), and the browser counts that drawn content as overflow. The transcript's gutter rule (thread-preview.js) already ignores that drawn overflow and decides data-lf-overflows from where layout stands the turns. The native overflow-y: auto bar made a second decision from the drawn content, and those two decisions disagreed for the motion's length. The bar now follows the gutter rule: a transcript without data-lf-overflows gets scrollbar-width: none. It still scrolls; it just draws no bar while its turns fit.

Test. test_sending_during_a_stream_keeps_later_tokens_from_moving_the_reply now samples every frame of the waiting answer's growth. It asserts that the card's top never rises past its rest and that the reply row stays still. Its emulated room-taking bar (TRANSCRIPT_BAR_TAKES_ROOM) previously forced scrollbar-width: auto !important on every transcript, which would have overridden the new rule. It now unsets Leaf's thin bar on every transcript, whatever its overflow state, at a specificity one type selector above that rule and without !important, so the production rule hiding a fitting transcript's bar still applies.

Evidence. Both runs are on CI's Mac with the fixture at e6e8425 and leaf-dev suite flake --copies 36 --workers 1 --load 4 on the [pending] case, differing only in the production declaration:

  • With scrollbar-width: none removed (44795058690), 36 of 36 copies fail. The card reaches 125 px against its rest at 146 px, with content 286 px in a 252 px transcript and an 11 px bar.
  • With it restored (44795063442), 36 of 36 copies pass.

On Linux, with this fixture, both cases of the stream test and the two gutter tests (test_a_card_that_scrolls_gives_its_scrollbar_room, test_a_card_that_fits_keeps_no_room_for_a_scrollbar) pass. On Linux the stream test passes without the production declaration too, so the Mac runs above are the evidence for the fix.

The change only affects the card while it moves. At rest a fitting transcript drew no bar before and draws none now, so before-and-after stills would look the same.

Closes #6611 — automated triage

An answer's arrival motion draws the transcript's turns below where they stand,
which the browser counts as overflow. On a host whose scrollbars take room the
native bar then showed for the motion's length, rewrapping an answer at a wrap
boundary a line taller, so the card rose a line and dropped back. The bar now
shows only where the gutter rule finds the turns overflow (data-lf-overflows),
so the bar and its gutter make one decision. The transcript still scrolls.

The test's emulated room-taking bar now applies where Leaf shows its bar, and the
stream test samples every frame of the waiting answer's growth: the card's top
moves only toward its rest.

Closes #6611
@max-sixty

Copy link
Copy Markdown
Owner

@leaf-agent The reported failing and passing runs used different scrollbar emulation. Between ed33bcc and c9bdd45, the fixture narrowed its scrollbar reset to [data-lf-overflows]; without that attribute, Chromium disables the fixture's 11 px WebKit bar, and the Mac runner defaults to overlay scrollbars. Please keep the room-taking scrollbar emulation independent of that attribute, then show the same focused test fails when only the production scrollbar-width: none declaration is removed and passes when restored.

This was written by Codex on behalf of max

…state

The fixture that gives the transcript a room-taking bar unset Leaf's thin
bar only on a transcript marked data-lf-overflows, so elsewhere Chromium
fell back to the Mac runner's overlay bar and the test stopped emulating a
bar that takes room. It now unsets the thin bar on every transcript, at a
specificity just above that rule, so Leaf's own rule hiding a fitting
transcript's bar still applies.

Refs #6611

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description's Test and Evidence sections still describe the fixture this head replaced, and the runs they cite used that fixture. The body says the emulated bar now applies only where [data-lf-overflows], but e6e8425 makes it apply to every transcript, using :not(a) to sit one type selector's weight above Leaf's thin bar and below the new :not([data-lf-overflows]) rule. The passing run 44785812189 used the narrowed fixture, which let the Mac's overlay bar stand in wherever the attribute was missing. So the 54-of-54 pass doesn't show that the production rule fixes anything. As the maintainer said, the evidence the fix needs is the same Mac run at this head with only scrollbar-width: none removed, failing, and then restored, passing. The "On Linux … pass" line can't stand in for that run. On Linux at this head the [accepted] and [pending] cases both still pass with the production rule deleted, 3 of 3 times, so Linux doesn't tell a fixed transcript from a broken one. Once the Mac run is in, rewrite those two sections to describe it.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Thanks — the emulation no longer depends on data-lf-overflows (e6e8425). The fixture now unsets Leaf's thin bar on every transcript, one type selector above that rule (.lf-margin-thread .lf-thread-transcript:not(a)) and without !important. So the 11 px WebKit bar applies wherever the transcript scrolls, and the production :not([data-lf-overflows]) { scrollbar-width: none } rule still wins.

Same fixture, same focused case ([pending], --copies 36 --workers 1 --load 4) on CI's Mac, with only the production declaration changed:

  • scrollbar-width: none removed (44795058690): 36 of 36 copies fail, with the card at 125 px against its rest at 146 px and an 11 px gutter.
  • Restored, at the PR head (44795063442): 36 of 36 pass.

I've updated the description to match.

@leaf-agent
leaf-agent merged commit 0dbdd83 into main Nov 21, 2026
7 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-6611 branch November 21, 2026 06:49
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.

Margin card rises a line and drops back while an arriving answer's motion shows the transcript's scrollbar

2 participants