Skip to content

Commit 72bac33

Browse files
fix(web): expanding Worked for at the bottom no longer jumps to the end
LegendList keeps its initial scroll-at-end target after mount and re-pins to it on the next data change, so toggling a disclosure before the first scroll jumped the list to the end. End that initial scroll in place on toggle. The test clicks through the DOM and drops fake timers, which froze LegendList mid-layout and made Playwright's click time out. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent aee76a8 commit 72bac33

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎apps/web/src/components/chat/MessagesTimeline.browser.test.tsx‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,8 @@ describe("MessagesTimeline work rows", () => {
244244
expect(viewport.scrollTop).toBeGreaterThan(0);
245245
const top = heading.element().getBoundingClientRect().top;
246246
const height = viewport.scrollHeight;
247-
using _timers = fakeTimers();
248-
await heading.click();
249-
await act(() => vi.advanceTimersByTime(1000));
247+
// Playwright's actionability retries scroll the list while Legend positions cells.
248+
heading.element().dispatchEvent(new MouseEvent("click", { bubbles: true }));
250249
await vi.waitFor(() => {
251250
expect(viewport.scrollHeight).toBeGreaterThan(height + 500);
252251
expect(heading.element().getBoundingClientRect().top).toBeCloseTo(top, 0);

‎apps/web/src/components/chat/MessagesTimeline.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,10 @@ const ConversationTimeline = memo(function ConversationTimeline({
490490
const suspendEndScrollMaintenanceForDisclosure = (anchorKey: string) => {
491491
disclosureAnchorKeyRef.current = anchorKey;
492492
setDisclosureToggleSettling(true);
493+
// Legend keeps its initial end target until an imperative scroll supersedes it and
494+
// re-pins to it on the next data change; scrolling to the current offset ends it in place.
495+
const list = listRef.current;
496+
if (list) void list.scrollToOffset({ offset: list.getState().scroll, animated: false });
493497
scheduleDisclosureSettle();
494498
};
495499

0 commit comments

Comments
 (0)