Skip to content

Let find-in-page reach folded thread messages - #4518

Merged
max-sixty merged 2 commits into
mainfrom
agent-ae355f2a1ddfcea2e
Oct 27, 2026
Merged

max-sixty merged 2 commits into
mainfrom
agent-ae355f2a1ddfcea2e

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A closed fold in a thread's transcript hid its messages with plain hidden, so the browser's find-in-page skipped their words. Leaf's own travel reached them only through revealedBy, an internal opener registry in widget-elements.js whose only user was the transcript. #4500 had kept that second mechanism because thread readers asked checkVisibility(), which is true for an element hidden until found, since it keeps its own box.

Folded messages are now hidden="until-found", and each listens for beforematch to open its fold. Find-in-page, text-fragment links and Leaf's reveal() therefore all open a fold the same way, and revealedBy is deleted.

geometry.js gains showsContents(node, options), which is checkVisibility but false for an element hidden until found. The readers that asked whether a message shows now use it: messages.js shown/hidden, reply-landing.js returnTurn, transcript.js foot and the fold-away check, floating-panel.js fitAnswer, the margin card's last shown message, and anchor-travel.js returnToFragment, which wrote the same test by hand. presented uses it too. A CSS rule drops the margin of an empty folded box.

Behavior change: ⌘F now finds and opens folded thread messages, including progress behind a run's face.

Part of #3833. No protocol bump: widget-api.js exported neither reveal nor revealedBy.

Tests: new tests/browser/threads/test_summaries.py::test_the_browser_s_search_and_leaf_s_travel_open_a_closed_fold, which follows a same-page text-fragment link (the browser's find reveal, which Playwright can't press) and then a fragment link (Leaf's travel). It fails with plain hidden restored. Also pnpm run test:runtime (682 passed), pnpm run check:browser, and 33 focused browser cases over folds, summaries, progress, Next unread, read state and fragment return. One of them, test_progress_disclosure_keeps_its_words_visible_beside_margin_paging[311-True], fails identically with the original runtime.

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

A closed fold in a thread's transcript (an agent summary, or progress
behind its run's face) now hides its messages with hidden="until-found"
instead of plain hidden. The browser's find-in-page, and a text-fragment
link, which reveals by the same algorithm, now reach a folded message's
words and open its whole fold; before, they skipped them. The transcript
listens for `beforematch` on each message and opens the fold, so its own
state (the toggle, aria-expanded, the other covered messages) follows
whichever revealed it, the browser or Leaf's travel (`reveal`).

That removes the runtime-internal `revealedBy` registry in
widget-elements.js, whose only user was the transcript: `reveal` now
opens thread folds the way it opens any widget's, by `beforematch`.

An until-found element keeps an empty box, and `checkVisibility` is true
for it, so readers that asked `checkVisibility` whether a message shows
would take a folded one as shown (an earlier attempt broke the view
opening on the summary holding the first unread reply). geometry.js gains
`showsContents(node, options)`, `checkVisibility` that also counts an
element hidden until found as not shown, and those readers ask it:
messages.js (which drawing holds a reply's widgets), reply-landing.js
(`returnTurn`), transcript.js (`foot`, and whether a leaving message
folds away), floating-panel.js (`fitAnswer`'s drawn messages),
thread-preview.js (the card's last shown message), and anchor-travel.js
(`returnToFragment`, which spelled the same test out by hand).
`presented` asks it too. browser/AGENTS.md lists it under "One answer for
each question". A folded message takes no margin (surfaces.css).

`revealedBy` was never exported from widget-api.js, so no protocol bump.

Test: test_the_browser_s_search_and_leaf_s_travel_open_a_closed_fold
drives a same-document text-fragment navigation into a closed fold and
then a fragment link into it; both fail with plain `hidden` or without
the `beforematch` listener.
# Conflicts:
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-data.js
@max-sixty
max-sixty merged commit d0fb1f6 into main Oct 27, 2026
4 checks passed
@max-sixty
max-sixty deleted the agent-ae355f2a1ddfcea2e branch October 27, 2026 22: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