Repository navigation
Let a sample's first click or key end its height hold, and stop relaying a child's later arrivals - #4790
Merged
Conversation
…d stop relaying a child's later arrivals Three guarantees in the template sample host came from reasoning about edge cases rather than from anything a reader hit, and each kept its own machinery: - The frame held growth the child made "of its own accord" even after the reader pressed inside it, so the child counted every gesture until its rendering settled (`afterSettling`) and tagged each height with whether a gesture caused it. Now the reader's first input inside a child makes every later resize of that document theirs. This also closes the gap #2817 left open: content a script deferred before the click and revealed by it stayed held. - A Reset inside an arrived child's own sample sent the parent an `arriving` notice, so the containing page read as arriving again and held the frame's growth once more. The child now reports its first arrival only; work it starts after that is its own to count. `whenArriving` in presentation.js had no other user and goes. - `showThread` retried a selection in the next document when the child reloaded. Every caller already reapplies its view on `lf-sample-ready`, which fires for that document, so the selection now answers false on departure, as it does when Reset replaces it. Behavior that changed, by test: - `test_a_sample_reached_while_loading_holds_growth_the_reader_did_not_cause`: growth the child makes after the reader's press applies at once. - `test_a_sample_arriving_again_holds_growth_the_reader_did_not_cause` is deleted, and `test_a_sample_counts_each_document_its_frame_loads` no longer counts an inner Reset. - `test_sample_view_selection_waits_across_a_reload` becomes `test_a_reload_ends_a_sample_view_selection`, and the native-departure test expects the pending selection to answer false at departure.
# Conflicts: # browser/runtime/rendering.js # dist/kernel/kernel.json # dist/kernel/runtime/bundle-content-layout.js # dist/kernel/runtime/bundle-restore-state.js
…ight A wheel over a sample frame that is still loading reaches the child's document, which reported it as input, and the containing page took any input as the reader claiming the frame: the held resize applied mid-scroll and what follows the sample jumped (238 px in a probe with a 600 px child, on main as well as on this branch). The containing page now releases only on a click, a keydown or an input event, the events that activate something; a wheel or a touch that scrolls past the frame claims nothing, as the platform's user activation leaves both out. The child still reports every input type, since focus.js reads presses and keys from it. The hold test now wheels over the frame and asserts it keeps its height; with release on every input it fails in Chromium and Firefox.
# Conflicts: # browser/runtime/rendering.ts
…ab release tested module-authoring.md still listed the removed `arriving` notice and `height`'s `gesture` field, and didn't say `input` carries its event type, which lf-sample's release rule now reads. The hold test regains the hidden-tab step the gesture rewrite dropped: it was the only browser test of held growth showing once the reading breaks. It now waits for the reading to resume before going on. Comments stop justifying the release list by user activation, which counts more events than the list does, and the child's header points to the rule rather than restating it.
leaf-agent
approved these changes
Oct 31, 2026
max-sixty
added a commit
that referenced
this pull request
Oct 31, 2026
Main's #4790 and this branch each rebuilt dist/kernel, and the textual merge of the two left leaf.js and kernel.json stale for the merged sources.
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.
Removes three mechanisms from how a page hosts a template
lf-sample. Each one existed only for a rare case, and the code they guarded is the code most likely to misbehave in that case. The branch is net −100 lines. The runtime and widget lose 40 of them, about 25 of those logic.A click or key inside the sample ends its height hold for that document. While a child is still arriving, a frame the reader can see keeps its loading height, so nothing below it moves (
heldGrowth). Before, the child counted gestures until their rendering settled (afterSettling) and tagged each height notice with whether a gesture caused it. The host then went on holding untagged growth for as long as the child was still arriving. Now the reader's first click, key or typed text inside the child makes every later resize of that document theirs. The child stops counting and thegestureflag goes. Whatever grows while the child is still arriving after that press, moves what follows the frame. On every shipped template sample (docs/threads and the three developer galleries) a child goes from presented to arrived in 13–80 ms, so a press can't land between the two.A wheel or a touch scroll over a loading frame no longer releases the hold. The child reports every input type, and the host used to release on any of them. So scrolling past a sample that was still loading applied its held resize mid-scroll, and the content below jumped (238 px in a probe). That happened on main too. Now only
click,keydownandinputrelease. The child still reports every type, becausefocus.js(inputInFrame) reads presses and keys from it. One gap is left, and main has it too: a reading key such asj, pressed with focus in the sample, passes out to scroll the containing page as a wheel would, but as akeydownit still releases the hold. Telling "acted in the child" apart from "passed through it" needs the child's word, not the event type, so that's a follow-up.No re-arrival relay. The child reports
arrivedonce. Thearrivingnotice, the host's handler for it, andpresentation.js'swhenArrivingare gone. Work a child starts after it has arrived, such as Reset on one of its own samples, is now counted only by the child's own readiness. No shipped page nests template samples.showThreadresolvesfalsewhen the sample's document departs, as it already did when Reset replaced it, rather than retrying in the next document. Both shipped callers, the feature gallery and the thread-panel gallery, reapply their view onlf-sample-ready.skills/leaf/references/live-samples.mdsays so.module-authoring.mdnow lists the host's notices as they are: noarriving,heightwithoutgesture, andinputcarrying its{type}.Tests:
test_a_sample_reached_while_loading_holds_growth_the_reader_did_not_causenow asserts that a wheel over the frame keeps its height. With release on every input it fails in Chromium and Firefox. It still asserts that a hidden tab lets held growth through, and it asserts that growth after a click applies at once.test_a_sample_arriving_again_holds_growth_the_reader_did_not_causeand the inner-Reset half oftest_a_sample_counts_each_document_its_frame_loadsare deleted along with the relay.test_a_reload_ends_a_sample_view_selectionreplaces the across-reload selection test.test_sample_startup_exception_keeps_its_name_stack_and_documentfails on main in the same way: an extra "page failed to start: Failed to fetch" console error. This branch doesn't cause it.