Skip to content

Leave the band under a long thread's pinned reply row out of what is seen - #1880

Merged
max-sixty merged 3 commits into
mainfrom
thread-panel-reply-and-title
Oct 6, 2026
Merged

max-sixty merged 3 commits into
mainfrom
thread-panel-reply-and-title

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

The runtime's reading of what is on screen (geometry.js) took the sticky headers over a scroller's top out of its band (headerInset, --lf-top), but nothing at its foot. A long open thread in the Threads panel pins its reply row at the list's foot, so a turn under that row read as seen, and read acknowledgement (thread/read.js, which counts a message read once its whole extent has been shown) could count the part under the row.

A box sticking at a scroller's foot now passes its height and offset to what it stands over as --lf-bottom, registered beside --lf-top in theme.css. footerInset reads it the way headerInset reads --lf-top, and visibleBand and the clip walk take that band out at the foot as they do at the top. The reply row is the one such footer; its scroll-margin-bottom (from #1834) now derives from the same value, so where a landing stops and what counts as seen agree.

Since #1862 the clip walk's bands also feed target paint, so paint over thread content under the row is cut there too.

Both of the row's rules key on .lf-thread-content. #1834 had keyed its scroll margin on :is(… :has(> .lf-thread-reply) > :not(…), … *), a :has() before a target that names nothing, which Chrome restyles from the document root on every write. test_no_has_rule_restyles_the_whole_document missed it because it read only top-level compounds; it now reads each arm of a selector that is one :is()/:where(). Content in a card with no reply row now takes a ring's room of bottom scroll margin, which the list's own scroll padding already gives it.

The long-thread edges test in test_chrome_contracts.py now asserts that a turn straddling the reply row's top reads as seen only down to the row; it fails without the change.

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

max-sixty and others added 2 commits October 5, 2026 12:45
…seen

The runtime's reading of what is on screen took the sticky headers over
a scroller's top out of its band (`headerInset`, `--lf-top`) but nothing
at its foot, so a turn under a long thread's pinned reply row read as
seen there, and read acknowledgement could count it. A box sticking at
a scroller's foot now passes its height and offset to what it stands
over as `--lf-bottom`, and `footerInset` takes that band out of
`visibleBand` and the clip walk as `headerInset` does at the top. The
reply row's scroll margin derives from the same value.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/assets/runtime/geometry.js
leaf-agent
leaf-agent previously approved these changes Oct 6, 2026

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

CI is red on this head. test_no_has_rule_restyles_the_whole_document fails on the new selector: the rightmost :not(...) names no feature, so changes outside Threads can trigger document-wide restyling. The inline suggestion keeps the footer value on the thread content that holds the turns. The job also timed out while typing in test_a_wheel_return_attaches_the_comment_box_in_the_first_visible_frame[content-selection]; I have not established its cause.

Comment thread skills/leaf/assets/runtime/chrome.css Resolved
@leaf-agent
leaf-agent dismissed their stale review October 6, 2026 06:36

CI failed: the new unkeyed :has selector breaks test_no_has_rule_restyles_the_whole_document.

…) arms for :has()

The reply row's rules selected `:has(> .lf-thread-reply) > :not(…)`, a
`:has()` before a target naming nothing, which Chrome restyles from the
document root on every write. #1834's scroll-margin rule hid the same
shape inside a top-level `:is()`, which the test never read. Both now
key on `.lf-thread-content`, and the test reads each arm of a selector
that is one `:is()`/`:where()`.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 6459603 into main Oct 6, 2026
4 checks passed
@max-sixty
max-sixty deleted the thread-panel-reply-and-title branch October 6, 2026 07:12
max-sixty added a commit that referenced this pull request Oct 6, 2026
…1901)

A decided suggestion could keep showing its retired words: the slot
carried `data-lf-retired`, the `state.css` rule applied, and Chromium
still computed `display: inline`. The style was stale. The operation
that left it stale was a forced style read inside a hidden tab panel,
made by `bounds.js` from a MutationObserver.

## Cause

On every content change of a bounded block (`data-lf-bound`),
`hold.sync` found the block's scroller by calling `getComputedStyle` on
every box inside it (`scrollerOf`). The feature gallery's "Page &
layout" tab holds bounded logs, and an inactive tab panel is
`hidden="until-found"`, which is `content-visibility: hidden`. Each read
forced Chromium to style that skipped subtree. A Chrome
invalidation-tracking trace of a failing run shows the sequence:

- a row is added to a log in the hidden panel, and `:has()` invalidation
marks `#bg-gallery-tabs` for a subtree restyle and `main` for a local
one;
- in the same task, `declaresBound` reads style inside the panel, which
forces a display-lock style update (1011 such reads in a failing run,
against 1 in a passing one);
- that update restyles neither `main` nor `#bg-gallery-tabs` and clears
the dirty bits above them, so `#bg-gallery-tabs` stays dirty with
nothing pointing at it;
- every later write under it is never restyled, including the reject's
`data-lf-retired` on `#bg-insert lf-new`. `#bg-gallery-tabs` is never
resolved again for the rest of the run.

The forced pass orphaning a dirty ancestor is a Chromium defect. I could
not reduce it to a page without Leaf.

## Fix

- `bounds.js`: `sync` asks `skipped(bounded)` first, as geometry.js's
other readers of skipped content do. A skipped block keeps the scroller
it had, or stands as its own, and renews its size observation. The first
delivery after the block is drawn syncs again, so an `end` log that grew
while hidden opens on its newest entry.
- `reach.js`: `paintReadingReach` and `paintSidewaysReach` check
`unpainted` themselves. Review found that a bounded block arriving in a
hidden panel registered as a reading region and had its downward cue
painted at once, reading `overflow-y` and scroll extents in skipped
content from the same MutationObserver.

## Evidence

- Issue journey
(`test_a_decision_undone_leaves_every_suggestion_pin_where_it_stood`),
on macOS Chromium 153: at 0e52b1b it failed 25 of 32 copies, and 0 of
20 with the `bounds.js` change applied there.
- Main stopped reproducing after #1880 removed a non-subject `:has()`
rule (bisected over the 18 commits from 0e52b1b). That rule supplied
the pending subtree invalidation. Adding a no-op rule of the same shape
back to `chrome.css` (`.lf-zz-a:has(> .lf-zz-b) * {}`) fails 8 of 10
copies on main, and 0 of 20 with this change.
- New test `test_logs_in_a_hidden_tab_open_on_their_newest_entries`
grows one bounded log in a hidden tab, adds a second, and checks that
neither has its style or scroll extents read while the tab is hidden,
then that both open at their newest entry, twice. It fails without the
`bounds.js` change, without the `reach.js` change, and without the
renewed size observation.
- The tests that exercise bounded blocks, reading regions, and reach
cues (71 cases) pass, as does `npm run test:runtime`.
`test_render_controls.py::test_each_sampled_focus_ring_is_shown_whole_in_its_surface`
fails on current main without this change too.

## A more underlying fix?

Unverified. Other runtime readers still force style or layout in hidden
panels: `shownParts` for target paint (deliberate, per geometry.js's
header), `readingPosture` in `recordRegions` and `scrollersSettled`,
`margin-layout.js`'s `scrollFollows`, and `user-view.js`'s `seenRect`.
With this change and the provoking `:has()` rule, the issue journey
stopped failing (0 of 20), so none of them was seen to leave style
stale. The run that would settle it is a journey that makes one of them
read a hidden panel while an ancestor holds a pending `:has()` subtree
invalidation. Its candidate fix is for those primitives to answer
skipped content themselves (a last-seen scroller, an empty shown set)
instead of each caller asking `skipped` first. History read:
`notes/margin-stuck-style.md` (#1506, #1695, #1719), #1834 and #1880.

Fixes #1868

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[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