Skip to content

fix(sidebar): render the rows that rise into view on a folder collapse - #19755

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/sidebar-collapse-rows-late-paint-18121
Oct 13, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/sidebar-collapse-rows-late-paint-18121

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: When a sidebar folder collapses, the folder that rises into its place shows its session rows in the same frame as its header.

Collapse a tall folder in the list view from its pinned header. The next folder comes up under the header at once, but its lane is empty for one or two frames, and then its session rows appear. The gap shows with motion on and under prefers-reduced-motion.

Why it matters

A header over an empty lane reads as a flash on every collapse of a tall folder. The sidebar collapse was just made to close in one frame so the lane is never blank; this gap is the part of that blank lane that stayed.

Not a goal

  • Changing content-visibility: auto on .session-row in index.css, or the 60px placeholder every row measures before it paints (scroll memory and row windowing are built on it).
  • Rows that rise when a folder EXPANDS, or when the lane reorders for any other reason.
  • Collapses that do not start from the folder's header (none exist in the list view today).

What changed (motivation → approach → change)

Rows of a folder below the lane have never been rendered: .session-row is content-visibility: auto, and the browser only notices a skipped row has come on screen in the rendering update AFTER the layout that moved it. The collapse moves dozens of rows into the lane in one layout, so they paint one or two frames after the header, which has no such rule.

The fix is in the hook that already runs in the collapsed commit, before it paints (stickyCollapse.ts). It gives the rows that can rise into the lane content-visibility: visible inline, so they render in that frame, and takes the override off once the close has finished: the collapse duration, then two frames. It touches only rows AFTER the collapsing block in document order, and only as many as can reach the lane's bottom edge after rising by the body's height. Rows inside a closed folder in between are passed over without being measured (a measure would force layout of a skipped subtree, and they never rise). A never-rendered row above the lane keeps its placeholder height, so nothing above the header moves. In that same commit the hook now clears the earlier arm's TTL timer and release frame for every collapse, not only an instant close: the arm has rendered, so both are finished with, and the earlier collapse's forced rows go with them.

capture-collapse-rising-rows.mjs is the recording harness for this: it keeps every screencast frame across the collapse, measures the risen folder's header box and its first rows against the settled frame, and counts the frames on which the header has painted and the rows have not (exit 1 when there are any). Its scene is shared with capture-sticky-folder-collapse.mjs through lib/folder-collapse-scene.mjs.

Intended? / Repro

Intended? No. content-visibility: auto came in with #6684 as a render-cost cut for long lists; the frame-late paint is a side effect nobody chose. No RFC, doc or comment calls the header-first order a design. #18057 (merged 2026-10-08) closed the folder in one frame for exactly the opposite reason: so the lane is never blank. The issue's filmstrips come from that PR's branch, and its author filed the gap as a defect.

Repro on origin/main @ 0412948, with the harness above (dark + light, motion + reduced motion; headless Chromium, 1400×900, two folders of 40 rows, lane scrolled 400px into the first):

run header painted rows painted frames with header over blank rows
main, dark, motion 44 ms 77 ms 2 (44 ms, 60 ms)
main, light, motion 45 ms 78 ms 2 (45 ms, 61 ms)
main, dark, reduced motion 15 ms 25 ms 1 (15 ms)
main, light, reduced motion 17 ms 26 ms 1 (17 ms)
this branch, all four same frame as header same frame as header 0

The same run with .session-row{content-visibility:visible} injected on main also shows 0 blank frames, which pins the cause to that rule.

Backwards compatibility

Compatible: nothing is rejected, renamed or removed. The inline override is set and removed by the hook on its own timer; a row's style attribute reads as before once the close has finished.

Removes nothing: the diff adds a helper and a harness and moves fixture code into a shared module that both harnesses import.

Tests

stickyCollapse.test.ts:

  • renderRowsRisingInto renders only the rows after the block that can reach the lane (rows before it, rows inside it and rows too far below are left alone) and undoes it; the rows of a closed folder in between are neither measured nor rendered and do not end the walk; a body already closed rises by nothing, so only rows level with the lane are rendered; a missing lane or block is a no-op.
  • The hook renders the rising rows in the collapsed commit and lets them go only after the collapse duration plus two frames, outliving the instant-close release.
  • A new arm and a disarm let the rising rows go at once.

Each fails on main: the helper does not exist and no row carries content-visibility: visible after a collapse.

Manual verification

The harness runs above, on a production build served by lib/serve-dist.mjs. The sibling harness capture-sticky-folder-collapse.mjs still records the pinned header at the same top before and after the collapse (125.14 → 125.14) on this branch.

Screenshots / video

Filmstrips: every compositor frame from just before the collapse commits, cropped to the top of the sessions lane, labelled with its time from the commit and the per-frame verdict (red label = header painted, rows blank).

Before (main, dark): the frames at 44 ms and 60 ms show "beta folder" over an empty lane.

before, dark: two frames of header over blank rows

After (this branch, dark): rows arrive with the header.

after, dark: rows paint with the header

Light theme, reduced motion, and the blank frame itself

Before, light:

before, light

After, light:

after, light

Before, dark, prefers-reduced-motion (one blank frame):

before, reduced motion

After, dark, prefers-reduced-motion:

after, reduced motion

The measured box on main at 44 ms, then settled:

blank frame crop
settled frame crop

Related Issues

Fixes #18121

Pattern harvest

Rule candidate: review-prompt
Pattern: content moved on screen by a layout change (not a scroll) under content-visibility: auto paints a frame late; anything that must arrive with it in one frame needs visible for that commit.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality (new tests added; the suite runs in CI, not on the author host)
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@CrysisDeu
CrysisDeu requested review from a team and KiroCrewCaptain as code owners October 13, 2026 07:39
@CrysisDeu
CrysisDeu requested a review from mbriones98 October 13, 2026 07:39
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of fe5723aaa2db8da12fa1416ead40272de7a4094b — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check that the rows forced to content-visibility: visible re-measure without shifting the lane when the override comes off after FOLDER_BODY_COLLAPSE_MS plus two frames.

[DESIGN-REVIEWED] fe5723a

Description read

[DESCRIPTION-READ] 6adb4cc254a2517e5f995c2937232f26fbf386760526da48a955c67c23a62f9a

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of fe5723aaa2db8da12fa1416ead40272de7a4094b — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Confirm that renderRowsRisingInto runs on every collapse, so animated closes now force rows visible for 150 ms plus two frames, not only pinned ones.

Not justified as shipped

  • Item 3 — rides along: the harness is evidence for the fix; it is not part of the fix. This repo already has 728 capture-*.mjs scripts, so it adds no new kind of surface.
  • Item 4 — rides along: "moves fixture code into a shared module that both harnesses import". This is a refactor of the sibling harness, with no change in behaviour.

What this change ships

Inventory (5 items) — 3 justified

Intent: A FIX. When a sidebar folder collapses, the folder that rises into its place should show its rows in the same frame as its header (#18121, with a repro table and tests that fail on main).

  1. The rows of the risen folder now paint in the same frame as its header on collapse — justified
  2. Any collapse, not only an instant close, now cancels the earlier arm's TTL and release frame — justified
  3. A new screencast harness counts the frames where the header is over blank rows — rides along
  4. The fixture scene moved into lib/folder-collapse-scene.mjs, which both harnesses share — rides along
  5. renderRowsRisingInto is exported and has one consumer, the hook — justified

[FIRST-PRINCIPLES-REVIEWED] fe5723a

Description read

[DESCRIPTION-READ] cb9e87103da3bbb6d08cc50a7a906932603fbae8c16e04c5a8afd36945256ad0

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of fe5723aaa2db8da12fa1416ead40272de7a4094b — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Check one thing before merge: whether a long scroll right after a collapse shows any row-height jump once the inline content-visibility override is removed.

[UX-REVIEWED] fe5723a

Description read

[DESCRIPTION-READ] a040a2a0873cf18869f9cb8040782617cf752d2c0ab6f7994c7152c07b418dda

That sha256 names everything this verdict read: the PR description, plus the 11 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed fe5723aaa2db8da12fa1416ead40272de7a4094b — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] fe5723a

Verdict parsed from the review's SHA-scoped output markers for commit fe5723aaa2db8da12fa1416ead40272de7a4094b.

False positive or not applicable? A repository writer can comment:
/ai-review override fable fe5723aaa2db8da12fa1416ead40272de7a4094b: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of fe5723aaa2db8da12fa1416ead40272de7a4094b and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] fe5723a

False positive or not applicable? A repository writer can comment:
/ai-review override gpt fe5723aaa2db8da12fa1416ead40272de7a4094b: <one-sentence reason>

@CrysisDeu
CrysisDeu force-pushed the fix/sidebar-collapse-rows-late-paint-18121 branch from 9155604 to 9d14419 Compare October 13, 2026 07:55
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 13, 2026
Collapsing a tall list-view folder brings the next folder up under the
pinned header in one frame. Its header painted on that frame, but its
session rows stayed blank for one or two more: `.session-row` is
`content-visibility: auto`, so rows that were below the lane had never
been rendered, and the browser only notices they have come on screen in
the rendering update after the layout that moved them. The gap showed
with motion and under prefers-reduced-motion alike.

The collapse hook now gives the rows that can rise into the lane
`content-visibility: visible` inline in the collapsed commit, before it
paints, and takes the override off once the close has finished (the
collapse duration, then two frames). Only rows after the collapsing
block in document order, and only as many as can reach the lane's
bottom edge, so a never-rendered row above the lane keeps its
placeholder height and nothing above the header moves.

A recording harness, capture-collapse-rising-rows.mjs, measures each
screencast frame of the collapse against the settled frame and counts
the frames on which the risen folder's header has painted and its rows
have not; it shares its scene with capture-sticky-folder-collapse.mjs.
@CrysisDeu
CrysisDeu force-pushed the fix/sidebar-collapse-rows-late-paint-18121 branch from 9d14419 to fe5723a Compare October 13, 2026 08:20
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

self-added: yes
mechanism: renderRowsRisingInto walks every .session-row after the block and measures each until one is past the lane

  • Collapsing a folder can still flash empty rows when an already-collapsed folder sits below it span=c97684105ab3

Outcome: fixed in fe5723a.
Verified the premise in headless Chromium: getBoundingClientRect on a row inside a content-visibility: hidden body does force its layout, and the rows report tops growing under the closed header (row 19 of a closed body measured at top 1020 against a 0-height track), so with 12 or more mounted rows in a closed folder between the block and the next open folder the walk broke early and the open folder's rows kept content-visibility: auto.
Fix: rows with a closed FolderBody ancestor (row.closest('[inert]')) are passed over before any measure; the break applies only to rows in flow. Test added: the rows of an inert folder in between are neither measured nor forced, and the open folder's rows after it are still rendered.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • Item 4 — undeclared: cancelRelease() moved out of the instantCloseId branch span=7fb16c8d8152

Outcome: fixed (declared). The description's What changed now states that every collapsed commit clears the earlier arm's TTL timer and release frame, and why: the arm has rendered, so both are finished with, and the earlier collapse's forced rows go with them. Behaviour for a non-instant close is unchanged in effect: a non-pinned arm never sets the TTL timer or the release frame, so there was nothing for the call to cancel before this change; what it now also clears is the rising-rows override this PR adds.

@CrysisDeu

Copy link
Copy Markdown
Contributor Author
  • Item 6 — rides along: the fixture move into lib/folder-collapse-scene.mjs span=dacd9045bc47

Outcome: rebutted (kept, declared). The new recording harness needs the same two-folder scene as capture-sticky-folder-collapse.mjs; a second copy of the fixtures and routes fails the repository's jscpd gate (one clone, 353 tokens, observed locally before the move), so the shared module is what lets the harness exist without a duplicate. The description names the move in What changed.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Oct 13, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) October 13, 2026 10:04

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tier 1 auto-approve: fix (5 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: fixes rows that rise into view on a folder collapse painting late, by rendering them for the collapse frame and restoring content-visibility afterwards; the rest is a shared recording scene for the capture scripts and tests.

@KiroCrewCaptain
KiroCrewCaptain merged commit c013bd3 into main Oct 13, 2026
147 of 149 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/sidebar-collapse-rows-late-paint-18121 branch October 13, 2026 10:05
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 13, 2026
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.

Session rows paint a few frames after their folder rises into view on a collapse

2 participants