Skip to content

Commit 44e9c17

Browse files
fix(web): prevent sidebar shelf animations from overlapping headers
Expanding the bottom-anchored Working shelf moves newly revealed thread rows through the stationary Snoozed and Settled headers, briefly superimposing titles and section labels. The reported desktop recording was reproduced in Chromium on current main: at 60 ms, the second Working row intersects both lower headers. Track shelf expansion changes in the existing layout effect and reset list motion on those changes. Ordinary thread moves retain their existing animations; the shelf chevron still animates. At the same 60 ms checkpoint after the fix, the last Working row ends 1 px above Snoozed. Issue and before evidence: #25383 Verified expand/collapse on desktop and a narrow web viewport, keyboard activation, state after reload, and animated movement when settling a demo thread. check:changed passed formatting, lint, knip, affected package type checks, and 108 tests. macOS Electron was not separately exercised.
1 parent bfc7177 commit 44e9c17

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎apps/web/src/components/Sidebar.tsx‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,9 +1762,16 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
17621762
dragState === null && sidebarListItems.length + visibleDraftSessionCount > 0;
17631763
// Cache on both fields so layout-key changes trigger the effect even when animate is unchanged.
17641764
const listMotionPass = { layoutKey: listMotionLayoutKey, animate: listMotionAnimate };
1765+
const shelfExpansionKey = [workingShelfExpanded, snoozedShelfExpanded, settledShelfExpanded].join(
1766+
":",
1767+
);
1768+
const previousShelfExpansionKeyRef = useRef(shelfExpansionKey);
17651769
useLayoutEffect(() => {
1766-
listMotionRef.current?.update(listMotionPass.animate);
1767-
}, [listMotionPass]);
1770+
// Shelf rows would travel over stationary headers below the bottom-anchored shelf.
1771+
const shelvesUnchanged = previousShelfExpansionKeyRef.current === shelfExpansionKey;
1772+
previousShelfExpansionKeyRef.current = shelfExpansionKey;
1773+
listMotionRef.current?.update(listMotionPass.animate && shelvesUnchanged);
1774+
}, [listMotionPass, shelfExpansionKey]);
17681775
const handleThreadDragOver = (event: DragOverEvent) => {
17691776
const target = event.over
17701777
? resolveSidebarDropTarget(sidebarListItems, String(event.active.id), String(event.over.id))

0 commit comments

Comments
 (0)