The best way to control Claude Code, Codex and more from any computer or phone
fix(web): horizontal table scrolling preserves timeline follow (#24045)
Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Yukun Shan committed
Nov 14, 2026 at 17:08 UTC
2fa77fbf553209df8583e1075e6931b2a74e2765
3 files changed
+23
-3
apps/web/src/components/chat/timelineScrollTarget.test.ts
+18
-2
@@ -20,8 +20,13 @@ class ScrollElement extends EventTarget {
20
}
21
}
22
23
-function targetsTimeline(target: EventTarget | null, timeline: ScrollElement, deltaY: number) {
24
- return isTimelineScrollTarget(target, timeline as unknown as HTMLElement, deltaY);
23
+function targetsTimeline(
24
+ target: EventTarget | null,
25
+ timeline: ScrollElement,
26
+ deltaY: number,
27
+ wheel?: { deltaX: number; shiftKey: boolean },
28
+) {
29
+ return isTimelineScrollTarget(target, timeline as unknown as HTMLElement, deltaY, wheel);
30
}
31
32
function setup() {
@@ -46,6 +51,17 @@ beforeEach(() => {
51
afterEach(() => vi.unstubAllGlobals());
52
53
describe("timeline scroll targets", () => {
54
+ it.each([
55
+ { deltaX: 5, deltaY: -30, shiftKey: false, targets: true },
56
+ { deltaX: 80, deltaY: -30, shiftKey: false, targets: false },
57
+ { deltaX: -80, deltaY: 30, shiftKey: false, targets: false },
58
+ { deltaX: 0, deltaY: -30, shiftKey: true, targets: false },
59
+ ])("leaves sideways wheel gestures out of the timeline: %j", ({ targets, ...wheel }) => {
60
+ const { timeline } = setup();
61
+ const table = new ScrollElement(timeline);
62
+ expect(targetsTimeline(table, timeline, wheel.deltaY, wheel)).toBe(targets);
63
+ });
64
+
65
it.each([-30, 30])("keeps a nested tool group's scroll out of the timeline: %i", (deltaY) => {
66
const { timeline, group, content } = setup();
67
expect(targetsTimeline(content, timeline, deltaY)).toBe(false);
apps/web/src/components/chat/timelineScrollTarget.ts
+3
@@ -2,8 +2,11 @@ export function isTimelineScrollTarget(
2
target: EventTarget | null,
3
timeline: HTMLElement,
4
deltaY: number,
5
+ wheel?: Pick<WheelEvent, "deltaX" | "shiftKey">,
6
): boolean {
7
if (!(target instanceof Element) || !timeline.contains(target) || deltaY === 0) return false;
8
+ // Shift-wheel scrolls sideways; trackpads can add vertical noise to a horizontal swipe.
9
+ if (wheel?.shiftKey || Math.abs(wheel?.deltaX ?? 0) > Math.abs(deltaY)) return false;
10
11
for (
12
let element: Element | null = target;
apps/web/src/components/chat/timelineViewport.ts
+2
-1
@@ -84,7 +84,8 @@ export function attachTimelineViewport(
84
for (const listener of listeners) listener(navigation);
85
};
86
const handleWheel = (event: WheelEvent) => {
87
- if (event.ctrlKey || !isTimelineScrollTarget(event.target, scrollNode, event.deltaY)) return;
87
+ if (event.ctrlKey || !isTimelineScrollTarget(event.target, scrollNode, event.deltaY, event))
88
+ return;
89
emit({ source: "wheel", direction: event.deltaY < 0 ? "up" : "down" });
90
};
91
const handleTouchMove = () => emit({ source: "touch" });