Repository navigation
fix(sidebar): hold a scroll floor when a pinned folder collapses near the end of the list - #18130
Conversation
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Check the near-end collapse in Safari and Firefox. The author tested only Chromium, and the floor relies on how each engine clamps [DESIGN-REVIEWED] 3a44bbb Description read[DESCRIPTION-READ] 5eecf017f276668ef2918b5c2d35b8a9f939bb5652f84586a66b8463a8ec20d8 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 |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check that the blank space left under the list after the collapse is acceptable, and that the floor works in Safari and Firefox. The author tested only Chromium. What this change shipsInventory (5 items) — 5 justifiedIntent: when someone collapses a pinned folder near the end of the sessions list, the folder stays as the top row instead of the list sliding down. This is a FIX (Refs #17529, the near-end case left open after #17581, with a Playwright reproduction that fails on #17581's head).
[FIRST-PRINCIPLES-REVIEWED] 3a44bbb Description read[DESCRIPTION-READ] 5afd71570846448cbe4168d324512865c8277c9c49741e7d769b340958a33807 That sha256 names the PR description this verdict read. Recompute it with |
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Watch the "after" recording to check that the blank space left under the list after a near-end collapse doesn't look like a broken or half-loaded list. [UX-REVIEWED] 3a44bbb Description read[DESCRIPTION-READ] a571efc112d7a5763f7dc26957dfe8b0b9d498b6d03112908b8c453c0301f99b That sha256 names everything this verdict read: the PR description, plus the 5 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 |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
ff04506 to
601777c
Compare
|
Fixed in The Semgrep Verified locally: the 3 floor tests and the 21 sticky-collapse tests pass, and |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
iamwhatever
left a comment
There was a problem hiding this comment.
This PR targets the near-end case #17581 left open: collapsing a pinned folder near the bottom of the sessions list makes the browser clamp scrollTop, so the list slides down. It adds a zero-height scroll floor so the held position stays reachable. The approach goes at the real cause (scroll height drops below the held offset), and checks are green. But the current-head Opus finding is still unanswered, and I think it is real. In website/src/pages/chat-sidebar/collapseFloor.ts, contentHeight() sets marker.style.display = 'none' and then reads lane.scrollHeight. That forces a layout in which the content is shorter than scrollTop + clientHeight. Chromium and Firefox clamp the scroll offset during that layout, and restoring display does not bring scrollTop back. So the 1000 ms settle timer (releaseIfUnneeded), or any small upward scroll, can bring back the exact slide in the tail case. The Playwright spec's settled() probe finishes before FLOOR_SETTLE_MS, so nothing exercises this. Suggested fix: measure the content's bottom without taking the marker out of layout, for example with a zero-height end-of-content sentinel read through getBoundingClientRect() + scrollTop. Then add a tail-case assertion that waits past FLOOR_SETTLE_MS and checks that the collapsed header is still at its held position. The committed GIFs under temp-screenshots/ are acceptable because this is a fork PR. — crew-pr-reviewer
601777c to
3f306c6
Compare
|
issue (blocking): Fixed in The release check now leaves the marker in layout. It compares The Playwright spec now covers the settle window. The anchor gets @iamwhatever could you re-review when CI is in? |
|
note (non-blocking): The one red check on |
3f306c6 to
b3fa83d
Compare
|
note (non-blocking): Same-tree retrigger pushed as |
|
issue: E2E (stub ACP backend, offline) failed again on Both failing runs stop with This spec is part of that overrun. The run's report gives The push waits for a CI slot. |
b3fa83d to
c2bbc94
Compare
|
Replies to the First Principles and UX lanes on note (non-blocking): span=15cdeeeffdc0, note (non-blocking): span=82a3e303ee3b, thought (non-blocking): span=11a50a8e746b, the blank room below the list. It is the price of keeping the header where it was pinned when too little content is left below it. It only shows when the collapsed folder is near the end, it shrinks as the person scrolls up, and it goes away once the content reaches the floor. Without it the browser clamps note (non-blocking): span=d2ae76f742dc, only Chromium checked. The spec runs with Chromium's scroll anchoring on and off. Turning it off approximates Safari, which has no scroll anchoring. I have not run Safari or Firefox, and the description says so. |
… the end of the list
c2bbc94 to
3a44bbb
Compare
|
note (non-blocking): Rebased on main as The E2E (stub ACP backend, offline) run on |
iamwhatever
left a comment
There was a problem hiding this comment.
This PR fixes the near-end case left open by #17581. Collapsing a pinned folder near the bottom of the sessions list let the browser clamp scrollTop, and the list slid down. The root cause is addressed: a zero-height scroll floor in website/src/pages/chat-sidebar/collapseFloor.ts keeps the held offset reachable until content alone reaches it. iamwhatever's earlier request is addressed. contentPastFloor() now compares lane.scrollHeight against the marker's own bottom edge with the marker left in layout, so the forced-layout clamp is gone. The Playwright spec waits for data-collapse-floor=settled, then asserts the header is still held past FLOOR_SETTLE_MS and moves exactly 20px on a 20px scroll-up. The author reports that this spec fails with the old measurement restored. I read the production diff and the spec on head 3a44bbb (one commit). All checks pass, and every AI lane (Design, First Principles, UX, GPT, Opus) is PASS or clean on this head. The committed GIFs under temp-screenshots/ are acceptable because this is a fork PR. — crew-pr-reviewer
Problem / Motivation
Goal: Collapsing a pinned folder near the end of the sessions list leaves the closed folder as the top row, instead of the list sliding down.
#17581 fixed the main jump from #17529, where a folder with more folders below it collapsed and its header vanished off the top. One layout is still open. Collapse a pinned folder that sits near the end of the list, with too little below it to fill the lane.
holdPinnedHeaderThroughCollapsescrolls the lane back correctly. Then the body closes, the list becomes shorter than that scroll position, and the browser clampsscrollTop. The whole list slides down. In Chromium on #17581's head the collapsed header goes from 40px to 80px below the top of the lane, and the folder above comes back into view. Steps are in my comment on #17581 (#17581 (comment)), and jeeshofone agreed there that a scroll floor stacked on their hold is the right shape for it.Why it matters
The last folder in the list is a common one to collapse, and it's the one where the jump still happens. The person loses their place: the folder they just closed moves down a row and a different folder takes its spot.
Not a goal
FolderBodyclose animation, including the blank pane under a tall folder during its close.What changed (motivation → approach → change)
website/src/pages/chat-sidebar/collapseFloor.ts(new) holds a scroll floor through the collapse. The tree lane inwebsite/src/pages/ChatSidebar.tsxnow starts with a zero-height anchor holding one hidden, absolutely positioned 1px marker.holdPinnedHeaderThroughCollapseinwebsite/src/pages/chat-sidebar/stickyCollapse.tscallsholdScrollFloorjust before it scrolls. That places the marker so the lane's scroll height can't drop below the held position while the body closes. The marker is out of flow, so it doesn't change the lane's layout. It only extends the scrollable area. The result is blank room under the list. As the person scrolls up, the floor follows the highest point they reach, and it's removed once the content alone reaches it. With folders below there's nothing to hold, so the floor is released about a second after the collapse (FLOOR_SETTLE_MS). That check compares the lane'sscrollHeightwith the marker's own bottom edge and never hides the marker, because taking it out of layout lets the browser clampscrollTop. A child's rect won't work, because the lane's last child is aflex-1 min-h-0box clamped to the lane height.docs/feature-map/README.mdlists the new helper next tostickyCollapse.ts.Backwards compatibility
Compatible: the floor is a new out-of-flow element inside the tree lane, and
holdPinnedHeaderThroughCollapsekeeps its signature and still does the plain hold when no anchor is present.Removes nothing: the change adds a marker element and a scroll adjustment, and takes no path, key or behaviour away.
Tests
website/src/test/collapseFloor.test.ts, run throughholdPinnedHeaderThroughCollapse, covers three cases. First, the floor is held near the end of the list, lowered on scroll-up, never raised on scroll-down, and removed once the content reaches it. Second, the floor drops once the collapse settles when content below fills the lane. Third, a lane with no anchor still gets the plain hold.website/playwright/sidebar-folder-collapse-floor.spec.tsruns in real Chromium. It collapses a pinned folder from the header toggle with native scroll anchoring on and from the rail with it off, once with a long folder below and once near the end, for 4 cases. Both controls reach the floor through one call site, so crossing every control with every anchoring mode added about a minute to the shared E2E run without covering more of the floor. It checks that the header stays where it was pinned, that the next folder sits directly below it, that the header is still held after the floor's settle check and moves by exactly 20px on a 20px scroll up, that the floor releases on its own when rows fill the lane, and that it's gone after scrolling back up.stickyCollapse.test.tsand all 111ChatSidebar*test files (1155 tests) pass, and so dotsc -p tsconfig.app.json, eslint andnpm run i18n:check.Manual verification
I ran the Playwright spec in Chromium against a harness gateway serving this branch's build, rebased on main after #17581 merged, and all 4 cases pass in 27 s. On #17581's head alone the near-end cases fail with the header 40px lower. I haven't checked Safari or Firefox.
Screenshots / video
Before, with #17581 alone and the folder near the end: the list slides down and the collapsed folder drops a row.
After, with the floor: the collapsed folder stays the top row, with blank room below that goes away as you scroll up.
Related Issues
Refs #17529, the near-end case left after #17581.
Pattern harvest
Not generalizable: the clamp comes from this one lane shrinking under a held scroll position during a collapse animation, and the floor is the fix for that one layout.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.