The best way to control Claude Code, Codex and more from any computer or phone
fix(web): minimap Next turn no longer sticks on adjacent user messages (#33036)
Julius Marminge committed
Nov 12, 2026 at 16:36 UTC
c99201cc1515155600a216c964497a9a8b91bd84
3 files changed
+57
-3
apps/web/src/components/chat/MessagesTimeline.browser.test.tsx
+44
@@ -763,6 +763,50 @@ describe("MessagesTimeline messages", () => {
763
expect(turns).toEqual(turns.toSorted((a, b) => a - b));
764
});
765
766
+ it("steps the minimap's next turn past two adjacent user messages", async () => {
767
+ const props = baseProps();
768
+ const reply = (id: string) => message("Reply.\n\n".repeat(120), { role: "assistant" }, id);
769
+ const userIds = ["turn-0", "turn-1", "turn-2", "pair-a", "pair-b", "turn-3", "turn-4"];
770
+ const entries = [
771
+ ...["turn-0", "turn-1", "turn-2"].flatMap((id) => [message(id, {}, id), reply(`${id}-r`)]),
772
+ message("pair-a", {}, "pair-a"),
773
+ message("pair-b", {}, "pair-b"),
774
+ reply("pair-b-r"),
775
+ ...["turn-3", "turn-4"].flatMap((id) => [message(id, {}, id), reply(`${id}-r`)]),
776
+ ];
777
+ const session = cdp();
778
+ await session.send("Emulation.setEmulatedMedia", {
779
+ features: [{ name: "prefers-reduced-motion", value: "reduce" }],
780
+ });
781
+ try {
782
+ await using screen = await renderTimeline(entries, props);
783
+ const viewport = props.listRef.current!.getScrollableNode()!;
784
+ const strips = () => [...screen.container.querySelectorAll("[data-minimap-strip]")];
785
+ const turnAtTop = () =>
786
+ userIds.find((id) => {
787
+ const row = screen.container.querySelector(`[data-message-id="${id}"]`);
788
+ if (!row) return false;
789
+ const offset = row.getBoundingClientRect().top - viewport.getBoundingClientRect().top;
790
+ return offset >= 0 && offset < 100;
791
+ });
792
+ await act(() => {
793
+ void props.listRef.current!.scrollToIndex({ index: 0, animated: false });
794
+ });
795
+ await vi.waitFor(() => expect(strips()[0]?.getAttribute("data-in-view")).toBe("true"));
796
+
797
+ // Clicks again while the view has not moved, as a user would.
798
+ for (const id of userIds.slice(1)) {
799
+ const from = turnAtTop();
800
+ await vi.waitFor(async () => {
801
+ if (turnAtTop() === from) await click(screen.button("Next turn"));
802
+ expect(turnAtTop(), "turn at the top after Next turn").toBe(id);
803
+ });
804
+ }
805
+ } finally {
806
+ await session.send("Emulation.setEmulatedMedia", { features: [] });
807
+ }
808
+ });
809
+
810
it("preserves XML-like tags and comparisons in user messages as text", async () => {
811
const source = [
812
'Without reading a file, do you have <global-agent-instructions scope="workspace">',
apps/web/src/components/chat/MessagesTimeline.logic.ts
+1
@@ -280,6 +280,7 @@ export function workEntryIsVisibleInGroup(
280
}
281
const TIMELINE_MINIMAP_ITEM_SPACING = 8;
282
export const TIMELINE_MINIMAP_MIN_ITEMS = 2;
283
+export const TIMELINE_MINIMAP_TARGET_OFFSET = 24;
284
// Relative to the timeline, not the viewport, so an open terminal shrinks the rail and
285
// endpoint previews (centered on their strip) still fit above and below it.
286
const TIMELINE_MINIMAP_MAX_HEIGHT_CSS = "max(4rem, calc(100% - 14.75rem))";
apps/web/src/components/chat/MessagesTimeline.tsx
+12
-3
@@ -84,6 +84,7 @@ import {
84
isTimelineMinimapRowVisible,
85
resolveTimelineMinimapVisibleRange,
86
resolveTimelineMinimapHitStripWidth,
87
+ TIMELINE_MINIMAP_TARGET_OFFSET,
88
timelineTurnFoldRunIdsByEntryId,
89
liveAnswerPreview,
90
type MessagesTimelineRow,
@@ -944,9 +945,17 @@ const ConversationTimeline = memo(function ConversationTimeline({
945
strip.dataset.inView = next;
946
}
947
}
948
+ // Ignore rows ending within the offset minimap navigation leaves above its target, or
949
+ // Next turn keeps retargeting the same row. 1px absorbs device-pixel scroll rounding.
950
+ const currentInset = TIMELINE_MINIMAP_TARGET_OFFSET + 1;
951
+ const currentRange = resolveTimelineMinimapVisibleRange({
952
+ ...state,
953
+ scroll: scroll + currentInset,
954
+ scrollLength: state.scrollLength - currentInset,
955
+ });
956
const nextCurrentIndex = resolveTimelineMinimapCurrentIndex({
948
- visibleStart: visibleRange.start,
949
- visibleEnd: visibleRange.end,
957
+ visibleStart: currentRange.start,
958
+ visibleEnd: currentRange.end,
959
rowIndices: minimapRowIndices,
960
});
961
setMinimapCurrentIndex((current) =>
@@ -1479,7 +1488,7 @@ const ConversationTimeline = memo(function ConversationTimeline({
1488
void listRef.current?.scrollToIndex({
1489
index: item.rowIndex,
1490
animated: !window.matchMedia("(prefers-reduced-motion: reduce)").matches,
1482
- viewOffset: 24,
1491
+ viewOffset: TIMELINE_MINIMAP_TARGET_OFFSET,
1492
});
1493
}}
1494
/>