Repository navigation
Read the interaction gallery's on-screen state from the observer's latest record - #871
Merged
Merged
Conversation
…test record A delivery carries every record the observer accumulated since the last one, and only its last says where the gallery is now. Read at the first, the flag kept a position the gallery had already left, and since the observer reports crossings rather than a state nothing came afterwards to correct it. The threshold goes with it: the flag was read as isIntersecting, so the declared ratio governed nothing.
This was referenced Sep 20, 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.
nightlyonmainwent red at 41d012d on two independent browser cases (run 35490092549). This is the second:test_the_interaction_gallery_drives_real_widgetswaited for the gallery to reportPlayingand readReadyfor five seconds. The gallery reads whether it is on screen from the first record of anIntersectionObserverdelivery rather than the last, so one stale record settles it as off screen for the rest of the page's life.([entry]) => { onScreen = entry.isIntersecting; … }takes the oldest record in the delivery. A delivery carries every record accumulated since the previous one, and only its last says where the gallery is now. Nothing follows to correct a wrong answer, because the observer reports crossings rather than a state: the flag keeps a position the gallery has already left until it crosses that boundary again, and a gallery standing still in front of the reader never does. The callback now reads the last record.threshold: 0.2goes with it. The flag was read asisIntersecting, true for a single visible pixel, so the declared ratio governed nothing and only added deliveries at a boundary nobody read — a second reading of the same fact, free to disagree with the deliveries maintaining it. Whether any of the gallery is in view is the question playback asks, and that is now the boundary the observer reports. No behaviour moves with it.That
Readynames the off-screen state is #770's finding on this same surface: on screen, the task that writesReadygoes on to callplay(), which setsplayingsynchronously, so the browser never paints it. CI polledReadyseven times across its wait, so the flag stood false for all of it. The gallery's own arrival supplies the crossings that make it false — under a throttled CPU the observer delivers[true, 0.267]at the fragment position,[false, 0]as the page settles, then[true, 0.841]once the semantic arrival pass scrolls to it — and Chromium coalesces records for a single target when the main thread is busy between two rendering updates, which a direct probe on a plain page reproduces as a delivery of[[true, 0.5], [false, 0]]. Coalescing the last two arrival crossings leaves the flag onfalse.That interleaving would not come out of this host, which is quieter than CI's two-worker runner, so
test_the_interaction_gallery_reads_where_it_is_nowstates the delivery shape rather than waiting for it: it arrives with the gallery off screen, carries each observer record into the delivery after it, and scrolls the gallery into view. Againstmainthe status stays atReady, the reading CI reported; with this change it reachesPlaying.The first failure in that run, a response-surface case with an unrelated cause, is in a separate PR.