Skip to content

Fold a thread summary by hiding its messages where they stand - #3580

Merged
max-sixty merged 5 commits into
mainfrom
flat-transcript-fold
Oct 22, 2026
Merged

max-sixty merged 5 commits into
mainfrom
flat-transcript-fold

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A thread summary now folds the messages it covers by hiding them where they stand, instead of moving them into a container inside its checkpoint.

Why. Moving a node unloads an iframe in an engine without moveBefore: WebKit reloaded a frame in a covered message once as the summary arrived and twice as it was retracted. A selection inside the moved messages was lost in every engine.

How.

  • In thread/transcript.js, the checkpoint stands directly before its covered messages. They stay the transcript's own children and are hidden while the fold is closed.
  • aria-owns on the checkpoint groups them under it for assistive technology. In Chromium the covered messages are absent from the accessibility tree when the fold is closed and under the checkpoint when it is open.
  • The outline around an open fold spans siblings, so it is drawn with anchor positioning from the checkpoint's head to the last covered message's foot. The transcript becomes the positioning parent.
  • reply-landing.js and thread-preview.js skip hidden messages.

Evidence.

  • New test test_a_summary_folds_its_messages_where_they_stand, run in Chromium and WebKit, puts a frame in one covered message and a selection in another. The frame never loads again through arrival, close, open and retraction, and the selection survives arrival. On the old runtime it fails in both engines.
  • Every message box and the outline measured identical to before in Chromium, Firefox and WebKit, for the panel's and the margin card's summaries, open and closed.
  • Side effect: in Firefox, a margin card's message controls had sat about 150px off after scrolling, and now land where Chromium puts them.
  • pnpm run test:runtime passes (522 tests), as do test_summaries.py and test_agent_replies.py, after merging Hide ephemeral messages when their answer arrives #3534.

TODO.md loses the item this closes. It gains two:

  • the other places that still move live content (resolved threads into "Resolved · N", lf-diff comment threads on redraw, a modal into its opener's popover, a reply's widgets between views);
  • a summary's Show/Hide button ignoring a press while words are selected, which predates this change.

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

max-sixty and others added 4 commits October 21, 2026 23:50
A summary's or an answer's progress fold used to move the messages it
covers into a container inside its checkpoint, and back out when the
summary was retracted. Moving a node lost a text selection inside it in
every engine, and in WebKit, which lacks moveBefore, reloaded any frame
in it: once as the summary arrived and twice as it was retracted.

The transcript is now flat. A checkpoint stands before the messages it
covers, which stay the transcript's own children and are hidden in place
while the fold is closed. Behavior changes:

- A selection in a covered message survives the summary arriving, and a
  frame in one keeps its document through arrival, close, open and
  retraction (new test_a_summary_folds_its_messages_where_they_stand,
  Chromium and WebKit; it fails on the base in both).
- The checkpoint groups its messages for assistive technology with
  aria-owns, as the nesting did; aria-controls names the checkpoint.
- The open fold's frame spans siblings, so it is anchored from the
  checkpoint to its last message's foot, with the transcript as its
  containing block. Panel and margin geometry, frames included, measure
  identical to the base in Chromium, Firefox and WebKit.
- Making the transcript the containing block also moves message controls'
  containing block inside the margin card's scroller; Firefox now places
  them on scrolled messages as Chromium and WebKit do.
- The latest turn a separate transcript lands on, and the margin card's
  last shown message, skip hidden covered messages.

Tests move off .lf-summary-originals onto data-lf-summary.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ction bug

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/assets/runtime/thread/transcript.js
#	skills/leaf/kernel/kernel.json
#	skills/leaf/kernel/runtime/bundle-user-intent.js
#	tests/browser/threads/test_agent_replies.py
…longer folds

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This was referenced Oct 22, 2026
…sed checkpoint id

aria-controls named the checkpoint, the button's own ancestor; it now names
the covered messages. A thread-card comment still said a summary moves the
message the user stands on.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 7e0fed7 into main Oct 22, 2026
3 checks passed
@max-sixty
max-sixty deleted the flat-transcript-fold branch October 22, 2026 17:18
leaf-agent added a commit that referenced this pull request Oct 22, 2026
Move the thread content's positioning context outside the scrolling
transcript so a message control's focus ring stays visible at the
transcript's top edge. The summary fold outline keeps its anchored span
across sibling messages. This fixes the deterministic ring gap in the
failed [main browser
run](https://github.com/max-sixty/leaf/actions/runs/39829391472),
introduced by #3580.

Verified the failing rewrite focus test and the summary fold tests in
Chromium and WebKit after the change. The rewrite focus test failed
before this CSS change under both Chromium versions tested and passes
afterward. `pnpm run check:browser` passes. The generated shadow
stylesheet is updated with the source change.

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