Skip to content

Commit 2f69765

Browse files
committed
fix(sidebar): preserve entry opacity when shelves retarget
1 parent dba87ee commit 2f69765

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

‎apps/web/src/components/Sidebar.motion.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ describe("sidebar list motion", () => {
476476
entry.progress = 0.25;
477477
for (const row of [header, x, y]) row.offsetTop += 40;
478478
motion.update(true);
479-
expect(entry.cancel).toHaveBeenCalledOnce();
479+
expect(entry.cancel).not.toHaveBeenCalled();
480480
// Remaining 27px of the 36px entry plus the new 40px shift.
481481
expectMove(y, -13);
482482
});

‎apps/web/src/components/Sidebar.motion.ts‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ export function createSidebarListMotion(parent: HTMLUListElement) {
103103
running.get(node)?.animation.cancel();
104104
running.delete(node);
105105
};
106-
const cancelEntry = (node: HTMLElement) => {
107-
entering.get(node)?.animation.cancel();
108-
entering.delete(node);
109-
};
110106
const suspend = () => {
111107
for (const node of running.keys()) cancel(node);
112108
clearFades();
@@ -115,8 +111,10 @@ export function createSidebarListMotion(parent: HTMLUListElement) {
115111
};
116112
const move = (node: HTMLElement, offset: number) => {
117113
cancel(node);
118-
cancelEntry(node);
119-
if (offset === 0) return;
114+
const entry = entering.get(node);
115+
// The newer transform supersedes entry travel; its original opacity keeps fading.
116+
if (entry) entry.travel = 0;
117+
if (offset === 0 && !entry) return;
120118
const animation = node.animate(
121119
[{ transform: `translateY(${offset}px)` }, { transform: "translateY(0px)" }],
122120
motionTiming,

0 commit comments

Comments
 (0)