Repository navigation
Let find-in-page reach folded thread messages - #4518
Merged
Merged
Conversation
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
leaf-agent
approved these changes
Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 throughrevealedBy, an internal opener registry inwidget-elements.jswhose only user was the transcript. #4500 had kept that second mechanism because thread readers askedcheckVisibility(), 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 forbeforematchto open its fold. Find-in-page, text-fragment links and Leaf'sreveal()therefore all open a fold the same way, andrevealedByis deleted.geometry.jsgainsshowsContents(node, options), which ischeckVisibilitybut false for an element hidden until found. The readers that asked whether a message shows now use it:messages.jsshown/hidden,reply-landing.jsreturnTurn,transcript.jsfootand the fold-away check,floating-panel.jsfitAnswer, the margin card's last shown message, andanchor-travel.jsreturnToFragment, which wrote the same test by hand.presenteduses 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.jsexported neitherrevealnorrevealedBy.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 plainhiddenrestored. Alsopnpm 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.