Skip to content

Keep a scrolling thread card's words clear of a scrollbar that takes room - #4841

Merged
max-sixty merged 3 commits into
mainfrom
thread-hscroll
Oct 31, 2026
Merged

max-sixty merged 3 commits into
mainfrom
thread-hscroll

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A margin thread card's message list is a CSS subgrid that scrolls. Chromium (153 on Linux, 156 on macOS) and Firefox 155 leave an overflow: auto scrollbar out of a subgrid's track sizing, so where scrollbars take room (Linux, Windows, macOS with a mouse) a card whose messages overflowed ran its words under the bar and could scroll sideways by the bar's width: 10px in Linux Chromium with Leaf's thin bar, shown as a horizontal scrollbar along the foot of the messages. Both engines do subtract a scrollbar-gutter: stable gutter. A 30-line page with no Leaf in it reproduces the gap and that fix in both.

Once its messages overflow, the list now holds scrollbar-gutter: stable (data-lf-overflows, set by the measurement that already draws the list's fades). A thread that fits reserves no room (Ref #4288). The gutter goes only when the list's width or its number of shown messages changes: a picture the gutter narrows is shorter, so dropping the gutter whenever the messages fit flipped it every frame. A card that stops overflowing for another reason, such as a taller window or an emptied reply box, keeps its words the gutter's width narrower until then.

Two new tests in tests/browser/margin/test_card_reply.py, run with space-taking scrollbars: a thread that fits keeps no room for a scrollbar, and a scrolling one has no sideways travel, keeps its words clear of the bar, and holds its gutter still for a picture at the boundary. notes/browser-support.md records the engine gap, that no Chromium or Firefox bug tracks it, and how to recheck it in the Playwright Linux image.

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

…room

A margin card's transcript is a subgrid that scrolls. Chromium (153 and 156)
and Firefox (155) leave an `overflow: auto` scrollbar out of a subgrid's track
sizing, so where scrollbars take room (Linux, Windows, macOS with a mouse) a
card whose turns overflowed ran its words under the bar and could scroll
sideways by the bar's width: 10px in Linux Chromium with Leaf's thin bar,
shown as a horizontal scrollbar along the foot of the messages.

Once its turns overflow, the transcript now holds `scrollbar-gutter: stable`
(`data-lf-overflows`), which both engines subtract. A thread that fits reserves
nothing. The gutter goes only when the transcript's width or the number of
turns it shows changes: a picture the gutter narrows is shorter, so dropping
the gutter whenever the turns fit flipped it every frame. A card that stops
overflowing for another reason, such as a taller window, keeps its words the
gutter's width narrower until then.

The card scrollbar test splits in two: a fitting thread reserves no room, and
a scrolling one has no sideways travel, words clear of the bar, and a gutter
that stays put for a picture at the boundary. notes/browser-support.md records
the engine gap and how to recheck it.
notes/browser-support.md now says no Chromium or Firefox bug tracks the
subgrid's auto scrollbar case and that Leaf hasn't filed one, so a recheck is
the only signal that the data-lf-overflows rule can go.
# Conflicts:
#	dist/kernel/kernel.json
@max-sixty
max-sixty merged commit d375981 into main Oct 31, 2026
4 checks passed
@max-sixty
max-sixty deleted the thread-hscroll branch October 31, 2026 19:18
leaf-agent added a commit that referenced this pull request Nov 3, 2026
…window's top

`test_a_press_in_the_card_keeps_the_pressed_spot_still` failed at its first
reading on Linux and macOS since #4841: the disclosure moved 10px left and
6px down. At 1200x900 with three progress messages, the opened card grew up
to the window's top (y=8) and its transcript still overflowed by 6px, which
the press hold had absorbed by scrolling it. #4841 gives an overflowing
transcript a `scrollbar-gutter: stable` gutter so its words clear the bar;
that narrows the end-aligned disclosure's line by the bar's width and
rewraps the words, so the spot moved.

The test's subject is a card growing up past the disclosure, not a card
pinned against the window, so it now opens two progress messages, which fit.
The pressed spot is still asserted at every motion step, by pointer and key.
The case where a press makes the transcript overflow, and so moves the
pressed control by the gutter, waits on the decision in #5214.

Closes #5171
leaf-agent added a commit that referenced this pull request Nov 3, 2026
…ng the window's top (#5215)

`test_a_press_in_the_card_keeps_the_pressed_spot_still` has failed both
parametrizations on Linux and macOS since #4841: at the first motion
step the disclosure stands 10px left and 6px below where it was pressed.
Bisecting `[key]` over `d995f3e6d..cc5df72` lands on #4841. At
1200×900 with three progress messages, the opened card grows to the
window's top (y=8) and its transcript still overflows by 6px. Before
#4841 the press hold absorbed that by scrolling the transcript. #4841
gives an overflowing transcript a `scrollbar-gutter: stable` gutter,
which narrows the end-aligned disclosure's line by the bar's width and
rewraps the words above it.

The test is about a card growing up past the disclosure, not a card
pinned against the window. It now opens two progress messages, which
fit. Every pressed-spot assertion is unchanged, by pointer and by key.
This keeps #4841's gutter and the press hold in every case the test was
written for. The overflow case, where the pressed control does move by
the gutter, is #5214, left for the author of #4841 to decide.

Verification: both `[press]` and `[key]` failed on `main` (683c63e)
with the CI diagnostic, and both pass the pressed-spot assertions on
this branch. `[press]` then still fails later at line 221 on "1m ago".
That is #4403, a separate open cause. It failed `[press]` the same way
in every scheduled run from Oct 27 to Oct 31.

Closes #5171 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 3, 2026
…own (#5218)

The two long-draft cases of `test_send_grows_thread_around_the_words`
(`size3`, `size4`) have failed in every nightly `test-macos` run since
#4841 (passing 10-31 at `d995f3e6d`, failing 11-01, 11-02 and on the
11-03 dispatch). The cause is the test's browser, not the product: the
shared `browser` fixture launches with Playwright's `--hide-scrollbars`.
With that flag, the comment box's `overflow: auto` bar takes no room,
while the card's transcript still reserves its `scrollbar-gutter:
stable` gutter, which #4841 adds once the transcript overflows. So only
the card gives up the bar's width. On Linux that is 10px and fits within
the card's slack. On macOS the card wraps narrower than the box, so
lines rewrap and the words move (in the 11-02 run, a line-end word at
x=918.98 drops to the next line and the transcript shifts 273px).

Measured on Linux Chromium at the `size3` geometry, comparing the box's
text column with the card's:

| scrollbars | box bar | card gutter | box column right | card column
right |
|---|---|---|---|---|
| hidden (shared `browser`) | 0 | 10 | 990 | 993 |
| shown (`scrollbar_browser`) | 10 | 10 | 965 | 978 |
| short draft, no overflow | 0 | 0 | 1391 | 1404 |

With scrollbars shown, the box and the card give up the same bar and
keep the card's usual 13px offset, as they do with no bar at all. Hiding
scrollbars removes the box's bar but not the card's gutter, a pairing no
user's browser makes. So the two cases now run on `scrollbar_browser`.
On macOS that fixture may still draw overlay bars, and an overlay bar
reserves no gutter on either side. The assertion is unchanged: a sent
draft's words stay where they were typed.

Verification: both cases pass locally on Linux with shown bars. The
macOS evidence comes from a `ci` dispatch on this branch, whose
`test-macos` job runs them.

This leaves one part of #5174 open. On 11-02 at 05:46 the same two cases
failed once on the Linux `test` job ([run
41395985405](https://github.com/max-sixty/leaf/actions/runs/41395985405))
with a smaller rewrap: one line moved, and the card was again narrower.
They have passed in every Linux run since. That run used hidden bars
with Linux's 10px gutter, so this change does not account for it.

Refs #5174 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 4, 2026
… its turns (#5380)

A send's ride draws a thread card's turns below where layout stands
them, so the new turn rises from the transcript's foot (`box-motion.js`,
`streamContent`). Chromium counts that translation in the transcript's
`scrollHeight`. The card's gutter decision in `thread-preview.js`
compared `scrollHeight > clientHeight`, so on the frame the ride started
it saw a card that fits as overflowing, and set `data-lf-overflows`.
That turned on the transcript's `scrollbar-gutter: stable` (#4841). The
gutter stays until the card's width or number of turns changes, so it
outlived the ride. Under a classic scrollbar (a mouse, on Linux or
Windows) that cost the turns 10px, and a sent reply wrapped one word
earlier than its reply editor had. The decision now reads `scrollLimit`,
which `scrolling.js` already computes from layout while content rides,
for this exact case.

**What changes on screen:** after a send, under a mouse, the turns of a
card that fits run the full width of the reply field, with no empty
scrollbar gutter. A card whose turns really overflow still holds its
gutter. Touch, and any platform with overlay scrollbars, never had a
gutter and is unchanged.

<details><summary>Evidence</summary>

At the frame `data-lf-overflows` was set, the transcript read
`scrollHeight` 314 against `clientHeight` 240. Both messages were at
their final heights (85 and 127), each wearing `translate: 0px 80px`
from the `--lf-box-carry` ride. Once the ride ended, `scrollHeight` was
240 = `clientHeight`, but the attribute stayed. The gutter narrowed the
transcript from 578 to 568 (`clientWidth`), which puts the message's
text column at 530px against the reply editor's 540px.

Verification on this branch:
-
`tests/browser/test_render_send_placement.py::test_a_reply_written_in_a_card_keeps_its_line_breaks_once_sent`:
`[mouse]` fails on main and passes here, in 3 of 3 runs; `[touch]`
passes in both.
- `tests/browser/margin/test_card_reply.py` passes (52 tests), including
#4841's `test_a_card_that_fits_keeps_no_room_for_a_scrollbar` and
`test_a_card_that_scrolls_gives_its_scrollbar_room`.
- `pnpm run test:runtime` and `pnpm run check` pass.

`thread-preview.js` also reads the transcript's raw `scrollHeight` when
it caps the card's height. That path isn't behind this failure, so this
PR leaves it unchanged.

</details>

Closes #5332 — automated triage

Co-authored-by: leaf-agent <[email protected]>
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