@devries-cameron20 / t3code-1 / commits / 34de974868
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): clicking the timeline's empty padding keeps following a streaming reply (#34899)

Julius Marminge committed Nov 12, 2026 at 00:07 UTC 34de974868b5c9bf3cd991e806d826cf1cddd53d
2 files changed +38 -3
apps/web/src/components/chat/timelineViewport.browser.test.tsx
+27
@@ -79,4 +79,31 @@ describe("attachTimelineViewport", () => {
79 resize(800);
80 expect(sources).toEqual(["command", "command"]);
81 });
82 +
83 + it("reports a scrollbar press but not a click on the scroller's empty padding", async () => {
84 + await using screen = await render(
85 + <div
86 + data-testid="timeline"
87 + style={{ height: 300, width: 400, overflowY: "auto", padding: "0 42px" }}
88 + >
89 + <div style={{ height: 1200 }} />
90 + </div>,
91 + { router: false },
92 + );
93 + const timeline = screen.getByTestId("timeline").element() as HTMLElement;
94 + const viewport = attachTimelineViewport(timeline);
95 + const navigations: unknown[] = [];
96 + viewport.subscribe((navigation) => navigations.push(navigation));
97 +
98 + await userEvent.click(screen.getByTestId("timeline"), { position: { x: 10, y: 150 } });
99 + await userEvent.click(screen.getByTestId("timeline"), {
100 + position: { x: timeline.offsetWidth - 2, y: 150 },
101 + });
102 +
103 + expect(navigations).toEqual([
104 + { source: "pointer", onScrollbar: false },
105 + { source: "pointer", onScrollbar: true },
106 + ]);
107 + viewport.dispose();
108 + });
109 });
apps/web/src/components/chat/timelineViewport.ts
+11 -3
@@ -64,6 +64,8 @@ export interface TimelineViewport {
64
65 const UP_KEYS = new Set(["PageUp", "Home", "ArrowUp"]);
66 const DOWN_KEYS = new Set(["PageDown", "End", "ArrowDown", " "]);
67 +// Wide enough for an overlay scrollbar, which takes no layout space (macOS Firefox).
68 +const SCROLLBAR_HIT_PX = 16;
69
70 /**
71 * Owns the timeline scroll node's input listeners for as long as the node is
@@ -86,10 +88,16 @@ export function attachTimelineViewport(
88 emit({ source: "wheel", direction: event.deltaY < 0 ? "up" : "down" });
89 };
90 const handleTouchMove = () => emit({ source: "touch" });
89 - // Scrollbar drags produce no wheel/touch events; they are the only
90 - // pointerdowns whose target is the scroll node itself rather than a row.
91 + // Scrollbar drags produce no wheel/touch events. The scroll node's own padding
92 + // also targets it, so only a press at its trailing edge counts.
93 const handlePointerDown = (event: PointerEvent) =>
92 - emit({ source: "pointer", onScrollbar: event.target === scrollNode });
94 + emit({
95 + source: "pointer",
96 + onScrollbar:
97 + event.target === scrollNode &&
98 + scrollNode.getBoundingClientRect().right - event.clientX <=
99 + Math.max(SCROLLBAR_HIT_PX, scrollNode.offsetWidth - scrollNode.clientWidth),
100 + });
101 // Clicking message text can leave DOM focus on body, and keyboard scrolling
102 // bypasses wheel and pointer events, so scroll keys are heard app-wide.
103 // Body keys belong to the main timeline; a side chat's hears only its own.