From 178ccb69ed8e017e2dd0dca208ac66e3b1fdf158 Mon Sep 17 00:00:00 2001 From: flamboh Date: Wed, 18 Nov 2026 07:35:35 +0000 Subject: [PATCH 1/4] fix(web): mouse wheel over the thread minimap scrolls like the chat on macOS --- .../chat/MessagesTimeline.browser.test.tsx | 27 +++++ .../src/components/chat/MessagesTimeline.tsx | 45 ++++---- .../src/components/chat/TimelineMinimap.tsx | 93 +++++++++------ .../chat/timelineMinimapWheel.browser.test.ts | 54 --------- .../components/chat/timelineMinimapWheel.ts | 107 ------------------ 5 files changed, 108 insertions(+), 218 deletions(-) delete mode 100644 apps/web/src/components/chat/timelineMinimapWheel.browser.test.ts delete mode 100644 apps/web/src/components/chat/timelineMinimapWheel.ts diff --git a/apps/web/src/components/chat/MessagesTimeline.browser.test.tsx b/apps/web/src/components/chat/MessagesTimeline.browser.test.tsx index 013d478127b47..7df6dcd0c3070 100644 --- a/apps/web/src/components/chat/MessagesTimeline.browser.test.tsx +++ b/apps/web/src/components/chat/MessagesTimeline.browser.test.tsx @@ -670,6 +670,33 @@ describe("MessagesTimeline messages", () => { }); }); + it("lets the browser scroll the timeline for a wheel over the minimap", async () => { + setup(); + const props = baseProps(); + const entries = Array.from({ length: 16 }, (_, index) => [ + message(`Question ${index}`, {}, `user-${index}`), + message(`Answer ${index}`, { role: "assistant" }, `assistant-${index}`), + ]).flat(); + await using screen = await renderTimeline(entries, props); + const viewport = props.listRef.current!.getScrollableNode()!; + await vi.waitFor(() => expect(viewport.scrollTop).toBeGreaterThan(0)); + const start = viewport.scrollTop; + const reached: Array<[trusted: boolean, fromMinimap: boolean]> = []; + const record = (event: WheelEvent) => + reached.push([ + event.isTrusted, + event.target instanceof Element && + event.target.closest('[data-testid="timeline-minimap"]') !== null, + ]); + viewport.addEventListener("wheel", record); + using _listener = { [Symbol.dispose]: () => viewport.removeEventListener("wheel", record) }; + + await userEvent.wheel(screen.button(/^Jump to message/), { delta: { y: -100 } }); + + await vi.waitFor(() => expect(viewport.scrollTop).toBeLessThan(start)); + expect(reached).toEqual([[true, true]]); + }); + it("enables the minimap's next turn button on a thread restored above its bottom", async () => { setup(); const base = baseProps(); diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsx index c730075b9d8c7..9d0fd4d83df30 100644 --- a/apps/web/src/components/chat/MessagesTimeline.tsx +++ b/apps/web/src/components/chat/MessagesTimeline.tsx @@ -103,7 +103,6 @@ import { type TimestampFormat } from "@t3tools/contracts/settings"; import { type HandoffTimelineRun } from "./V2LifecycleRow"; import { TimelineSystemDivider } from "./TimelineSystemDivider"; -import { forwardWheelToTimeline } from "./timelineMinimapWheel"; import { TimelineMinimap } from "./TimelineMinimap"; import { type TimelineRowSharedState, @@ -831,6 +830,7 @@ const ConversationTimeline = memo(function ConversationTimeline({ const [timelineViewportElement, setTimelineViewportElement] = useState( null, ); + const [timelineScrollNode, setTimelineScrollNode] = useState(null); const { target: readyCitationRequest, positioning: citationPositioning, @@ -1251,6 +1251,7 @@ const ConversationTimeline = memo(function ConversationTimeline({ listRef.current = list; const scrollNode: HTMLElement | null = list?.getScrollableNode() ?? null; registerTimeline?.(scrollNode); + setTimelineScrollNode(scrollNode); const viewport = scrollNode ? attachTimelineViewport(scrollNode, (frame) => { const rowId = frame.closest("[data-timeline-row-id]")?.dataset.timelineRowId; @@ -1305,6 +1306,7 @@ const ConversationTimeline = memo(function ConversationTimeline({ } listRef.current = null; registerTimeline?.(null); + setTimelineScrollNode(null); }; }); @@ -1402,11 +1404,6 @@ const ConversationTimeline = memo(function ConversationTimeline({ ); - const forwardMinimapWheel = (event: WheelEvent) => { - const scrollNode = listRef.current?.getScrollableNode(); - if (scrollNode) forwardWheelToTimeline(event, scrollNode); - }; - if (showsEmptyState) { if (hideEmptyPlaceholder) { return ( @@ -1497,23 +1494,25 @@ const ConversationTimeline = memo(function ConversationTimeline({ ListHeaderComponent={listHeader} ListFooterComponent={timelineListFooter} /> - { - navigateTimeline(); - void listRef.current?.scrollToIndex({ - index: item.rowIndex, - animated: !window.matchMedia("(prefers-reduced-motion: reduce)").matches, - viewOffset: TIMELINE_MINIMAP_TARGET_OFFSET, - }); - }} - /> + {timelineScrollNode ? ( + { + navigateTimeline(); + void listRef.current?.scrollToIndex({ + index: item.rowIndex, + animated: !window.matchMedia("(prefers-reduced-motion: reduce)").matches, + viewOffset: TIMELINE_MINIMAP_TARGET_OFFSET, + }); + }} + /> + ) : null} diff --git a/apps/web/src/components/chat/TimelineMinimap.tsx b/apps/web/src/components/chat/TimelineMinimap.tsx index 60d817c6dc108..8a8f0b0cc9966 100644 --- a/apps/web/src/components/chat/TimelineMinimap.tsx +++ b/apps/web/src/components/chat/TimelineMinimap.tsx @@ -1,5 +1,6 @@ import { resolveTimelineMinimapPreview, type TimelineMinimapItem } from "./timelineMinimapItems"; import { useRef, useState, type MouseEvent } from "react"; +import { createPortal } from "react-dom"; import { T, useGT } from "gt-react"; import { ChevronDownIcon, ChevronUpIcon } from "lucide-react"; import { Button } from "../ui/button"; @@ -12,6 +13,7 @@ import { } from "./MessagesTimeline.logic"; import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; import { cn } from "~/lib/utils"; +import { observeResize } from "~/lib/observeResize"; // A release outside the window can skip `mouseup`, so the next button-free // `mousemove` also counts. @@ -31,30 +33,36 @@ function onMouseButtonsReleased(onRelease: () => void): () => void { } export function TimelineMinimap({ + scrollNode, hasPersistentGutter, hitStripWidth, currentIndex, atEnd, items, stripMap, - onWheel, onSelect, }: { + scrollNode: HTMLElement; hasPersistentGutter: boolean; hitStripWidth: number; currentIndex: number | null; atEnd: boolean; items: ReadonlyArray; stripMap: Map; - onWheel: (event: WheelEvent) => void; onSelect: (item: TimelineMinimapItem) => void; }) { const gt = useGT(); const [activeIndex, setActiveIndex] = useState(null); - const wheelTargetRef = (node: HTMLDivElement | null) => { - if (!node) return; - node.addEventListener("wheel", onWheel, { passive: false }); - return () => node.removeEventListener("wheel", onWheel); + const [frame, setFrame] = useState<{ left: number; height: number } | null>(null); + const measureFrame = (anchor: HTMLDivElement | null) => { + if (!anchor) return; + return observeResize([scrollNode, anchor], () => { + const left = scrollNode.getBoundingClientRect().left - anchor.getBoundingClientRect().left; + const height = scrollNode.clientHeight; + setFrame((current) => + current?.left === left && current.height === height ? current : { left, height }, + ); + }); }; const pressedOnStripRef = useRef(false); @@ -104,17 +112,17 @@ export function TimelineMinimap({ return null; } - return ( + const minimap = (
); })} - {activeItem ? ( - // Display-only: it overlaps the message column, and the strip keeps tracking beneath it. - - - - {activeItem.userText ?? User message} - - {activeItem.assistantText ? ( - - {activeItem.assistantText} - - ) : null} - - - ) : null}
); + return ( + <> + {createPortal( +
+ {minimap} +
, + scrollNode, + )} + {activeItem ? ( + // Display-only: it overlaps the message column, and the strip keeps tracking beneath it. +
+
+ + + + {activeItem.userText ?? User message} + + {activeItem.assistantText ? ( + + {activeItem.assistantText} + + ) : null} + + +
+
+ ) : null} + + ); } function TimelineMinimapNavigationButton({ diff --git a/apps/web/src/components/chat/timelineMinimapWheel.browser.test.ts b/apps/web/src/components/chat/timelineMinimapWheel.browser.test.ts deleted file mode 100644 index d107269da7b6f..0000000000000 --- a/apps/web/src/components/chat/timelineMinimapWheel.browser.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { describe, expect, it, vi } from "vite-plus/test"; - -import { fakeTimers } from "../../../test/render"; -import { forwardWheelToTimeline } from "./timelineMinimapWheel"; - -function mountTimeline() { - const timeline = document.createElement("div"); - timeline.style.cssText = "height: 200px; overflow-y: auto;"; - const content = document.createElement("div"); - content.style.height = "2000px"; - timeline.append(content); - document.body.append(timeline); - return Object.assign(timeline, { [Symbol.dispose]: () => timeline.remove() }); -} - -function wheel(deltaY: number, wheelDeltaY: number): WheelEvent { - const init = { cancelable: true, deltaY, wheelDeltaY }; - return new WheelEvent("wheel", init); -} - -describe("forwardWheelToTimeline", () => { - it.each([ - ["macOS", -360], - ["Linux and Windows", -120], - ])("scrolls %s trackpad deltas immediately", (_platform, wheelDeltaY) => { - using timeline = mountTimeline(); - forwardWheelToTimeline(wheel(120, wheelDeltaY), timeline); - expect(timeline.scrollTop).toBe(120); - }); - - it("glides mouse wheel notches and accumulates them", () => { - using timeline = mountTimeline(); - using _timers = fakeTimers(); - forwardWheelToTimeline(wheel(100, -120), timeline); - forwardWheelToTimeline(wheel(100, -120), timeline); - expect(timeline.scrollTop).toBe(0); - vi.advanceTimersByTime(75); - expect(timeline.scrollTop).toBeGreaterThan(0); - expect(timeline.scrollTop).toBeLessThan(200); - vi.advanceTimersByTime(100); - expect(timeline.scrollTop).toBe(200); - }); - - it("stops gliding when the user clicks or navigates", () => { - using timeline = mountTimeline(); - using _timers = fakeTimers(); - forwardWheelToTimeline(wheel(100, -120), timeline); - vi.advanceTimersByTime(50); - timeline.scrollTop = 1000; - window.dispatchEvent(new PointerEvent("pointerdown")); - vi.advanceTimersByTime(200); - expect(timeline.scrollTop).toBe(1000); - }); -}); diff --git a/apps/web/src/components/chat/timelineMinimapWheel.ts b/apps/web/src/components/chat/timelineMinimapWheel.ts deleted file mode 100644 index 5befc4efb8100..0000000000000 --- a/apps/web/src/components/chat/timelineMinimapWheel.ts +++ /dev/null @@ -1,107 +0,0 @@ -const MOUSE_WHEEL_SCROLL_MS = 150; -const PRECISE_WHEEL_DELTA_RATIOS = [1, 3]; - -interface WheelGlide { - from: number; - to: number; - start: number; - written: number; - frame: number; - interruptions: AbortController; -} - -const glides = new WeakMap(); - -function isPreciseWheel(event: WheelEvent): boolean { - if (event.deltaMode !== WheelEvent.DOM_DELTA_PIXEL) return false; - const { wheelDeltaY } = event as WheelEvent & { wheelDeltaY?: number }; - return ( - wheelDeltaY === undefined || - PRECISE_WHEEL_DELTA_RATIOS.some((ratio) => Math.abs(wheelDeltaY + ratio * event.deltaY) < 1) - ); -} - -function stopGlide(timeline: HTMLElement): WheelGlide | undefined { - const glide = glides.get(timeline); - if (!glide) return undefined; - cancelAnimationFrame(glide.frame); - glide.interruptions.abort(); - glides.delete(timeline); - return glide; -} - -function glideBy(timeline: HTMLElement, distance: number): void { - const current = stopGlide(timeline); - const scrollTop = timeline.scrollTop; - const base = current ? current.to + scrollTop - current.written : scrollTop; - const maxScrollTop = timeline.scrollHeight - timeline.clientHeight; - const glide: WheelGlide = { - from: scrollTop, - to: Math.max(0, Math.min(maxScrollTop, base + distance)), - start: performance.now(), - written: scrollTop, - frame: 0, - interruptions: new AbortController(), - }; - for (const type of ["pointerdown", "keydown"]) { - window.addEventListener(type, () => stopGlide(timeline), { - capture: true, - signal: glide.interruptions.signal, - }); - } - const step = (time: number) => { - if (!timeline.isConnected) { - stopGlide(timeline); - return; - } - const drift = timeline.scrollTop - glide.written; - glide.from += drift; - glide.to += drift; - const progress = Math.min(1, Math.max(0, (time - glide.start) / MOUSE_WHEEL_SCROLL_MS)); - timeline.scrollTop = glide.from + (glide.to - glide.from) * (1 - (1 - progress) ** 3); - glide.written = timeline.scrollTop; - if (progress < 1) { - glide.frame = requestAnimationFrame(step); - } else { - stopGlide(timeline); - } - }; - glide.frame = requestAnimationFrame(step); - glides.set(timeline, glide); -} - -export function forwardWheelToTimeline(event: WheelEvent, timeline: HTMLElement): void { - if (event.defaultPrevented || event.ctrlKey || event.deltaY === 0) return; - event.preventDefault(); - - const forwarded = new WheelEvent("wheel", { - bubbles: true, - cancelable: true, - deltaX: event.deltaX, - deltaY: event.deltaY, - deltaZ: event.deltaZ, - deltaMode: event.deltaMode, - clientX: event.clientX, - clientY: event.clientY, - screenX: event.screenX, - screenY: event.screenY, - altKey: event.altKey, - metaKey: event.metaKey, - shiftKey: event.shiftKey, - }); - if (!timeline.dispatchEvent(forwarded)) return; - - const pixelsPerUnit = - event.deltaMode === WheelEvent.DOM_DELTA_LINE - ? 16 - : event.deltaMode === WheelEvent.DOM_DELTA_PAGE - ? timeline.clientHeight - : 1; - const distance = event.deltaY * pixelsPerUnit; - if (isPreciseWheel(event) || window.matchMedia("(prefers-reduced-motion: reduce)").matches) { - stopGlide(timeline); - timeline.scrollBy({ top: distance }); - return; - } - glideBy(timeline, distance); -} From 82fea36cf2a4f03e33cc00a0c8d932dbd8e6354a Mon Sep 17 00:00:00 2001 From: flamboh Date: Wed, 18 Nov 2026 08:48:17 +0000 Subject: [PATCH 2/4] fix(web): size the portaled thread minimap with CSS instead of a resize loop The minimap measured the scroll node's height and wrote it back onto a child of that same scroll node. Without its stylesheet (browser tests) the minimap sits in flow, so every write grew the scroll node and fired the observer again: thousands of ResizeObserver loop errors and a minimap tall enough to cover the model picker. The timeline viewport is now a size container, and the minimap takes its height and left edge from container units. No measurement, no observer, same geometry as before. --- .../src/components/chat/MessagesTimeline.tsx | 2 +- .../src/components/chat/TimelineMinimap.tsx | 19 ++----------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsx index 9d0fd4d83df30..5b8a92122c290 100644 --- a/apps/web/src/components/chat/MessagesTimeline.tsx +++ b/apps/web/src/components/chat/MessagesTimeline.tsx @@ -1435,7 +1435,7 @@ const ConversationTimeline = memo(function ConversationTimeline({ {onCiteAssistantText && citationThreadRef ? ( diff --git a/apps/web/src/components/chat/TimelineMinimap.tsx b/apps/web/src/components/chat/TimelineMinimap.tsx index 8a8f0b0cc9966..fda289e37e480 100644 --- a/apps/web/src/components/chat/TimelineMinimap.tsx +++ b/apps/web/src/components/chat/TimelineMinimap.tsx @@ -13,7 +13,6 @@ import { } from "./MessagesTimeline.logic"; import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; import { cn } from "~/lib/utils"; -import { observeResize } from "~/lib/observeResize"; // A release outside the window can skip `mouseup`, so the next button-free // `mousemove` also counts. @@ -53,17 +52,6 @@ export function TimelineMinimap({ }) { const gt = useGT(); const [activeIndex, setActiveIndex] = useState(null); - const [frame, setFrame] = useState<{ left: number; height: number } | null>(null); - const measureFrame = (anchor: HTMLDivElement | null) => { - if (!anchor) return; - return observeResize([scrollNode, anchor], () => { - const left = scrollNode.getBoundingClientRect().left - anchor.getBoundingClientRect().left; - const height = scrollNode.clientHeight; - setFrame((current) => - current?.left === left && current.height === height ? current : { left, height }, - ); - }); - }; const pressedOnStripRef = useRef(false); const [passThrough, setPassThrough] = useState(false); @@ -115,14 +103,13 @@ export function TimelineMinimap({ const minimap = (
{createPortal( -
- {minimap} -
, +
{minimap}
, scrollNode, )} {activeItem ? ( From e7ca57ce35da52b9cced1fd48b07d57f84637ea4 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 18 Nov 2026 09:06:46 +0000 Subject: [PATCH 3/4] fix(web): keep the thread minimap on the viewport edge when the chat lane is inset The minimap's left offset assumed the scroller's inline padding was symmetric. With a workspace card or preview beside the chat, --chat-lane-inset-end widens only the end padding, which pushed the minimap off the left edge. The offset now cancels the inset difference, next to the padding rule it mirrors. Co-Authored-By: Claude Opus 5.5 --- apps/web/src/components/chat/TimelineMinimap.tsx | 2 +- apps/web/src/index.css | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/chat/TimelineMinimap.tsx b/apps/web/src/components/chat/TimelineMinimap.tsx index fda289e37e480..2989f078a5fde 100644 --- a/apps/web/src/components/chat/TimelineMinimap.tsx +++ b/apps/web/src/components/chat/TimelineMinimap.tsx @@ -103,7 +103,7 @@ export function TimelineMinimap({ const minimap = (
Date: Wed, 18 Nov 2026 09:22:41 +0000 Subject: [PATCH 4/4] fix(web): keep the portaled thread minimap unclipped and inside the timeline - Shift the rail right by any scrollbar gutter wider than 6px, so classic scrollbars (Firefox, 15px) no longer clip the rail and turn buttons, and narrow the hit strip by the same amount. - Clip the minimap and cap the rail so the turn buttons stay inside a very short timeline and below its top fade, and never grow its scroll range. - Give the preview card select-none and, in hover-only mode, the rail's 150ms fade-in. - Assert the wheel event over the minimap is never cancelled. --- .../chat/MessagesTimeline.browser.test.tsx | 18 ++++++++++-------- .../components/chat/MessagesTimeline.logic.ts | 17 ++++++++++++++--- .../src/components/chat/MessagesTimeline.tsx | 6 +++++- .../src/components/chat/TimelineMinimap.tsx | 18 ++++++++++++++---- 4 files changed, 43 insertions(+), 16 deletions(-) diff --git a/apps/web/src/components/chat/MessagesTimeline.browser.test.tsx b/apps/web/src/components/chat/MessagesTimeline.browser.test.tsx index 7df6dcd0c3070..54154c5e5f0b9 100644 --- a/apps/web/src/components/chat/MessagesTimeline.browser.test.tsx +++ b/apps/web/src/components/chat/MessagesTimeline.browser.test.tsx @@ -681,20 +681,22 @@ describe("MessagesTimeline messages", () => { const viewport = props.listRef.current!.getScrollableNode()!; await vi.waitFor(() => expect(viewport.scrollTop).toBeGreaterThan(0)); const start = viewport.scrollTop; - const reached: Array<[trusted: boolean, fromMinimap: boolean]> = []; - const record = (event: WheelEvent) => - reached.push([ - event.isTrusted, - event.target instanceof Element && - event.target.closest('[data-testid="timeline-minimap"]') !== null, - ]); + const reached: WheelEvent[] = []; + const record = (event: WheelEvent) => reached.push(event); viewport.addEventListener("wheel", record); using _listener = { [Symbol.dispose]: () => viewport.removeEventListener("wheel", record) }; await userEvent.wheel(screen.button(/^Jump to message/), { delta: { y: -100 } }); await vi.waitFor(() => expect(viewport.scrollTop).toBeLessThan(start)); - expect(reached).toEqual([[true, true]]); + expect( + reached.map((event) => [ + event.isTrusted, + event.target instanceof Element && + event.target.closest('[data-testid="timeline-minimap"]') !== null, + event.defaultPrevented, + ]), + ).toEqual([[true, true, false]]); }); it("enables the minimap's next turn button on a thread restored above its bottom", async () => { diff --git a/apps/web/src/components/chat/MessagesTimeline.logic.ts b/apps/web/src/components/chat/MessagesTimeline.logic.ts index 8d282aff42689..65137c382a520 100644 --- a/apps/web/src/components/chat/MessagesTimeline.logic.ts +++ b/apps/web/src/components/chat/MessagesTimeline.logic.ts @@ -315,8 +315,10 @@ const TIMELINE_MINIMAP_ITEM_SPACING = 8; export const TIMELINE_MINIMAP_MIN_ITEMS = 2; export const TIMELINE_MINIMAP_TARGET_OFFSET = 24; // Relative to the timeline, not the viewport, so an open terminal shrinks the rail and -// endpoint previews (centered on their strip) still fit above and below it. -const TIMELINE_MINIMAP_MAX_HEIGHT_CSS = "max(4rem, calc(100% - 14.75rem))"; +// endpoint previews (centered on their strip) still fit above and below it. The last term +// keeps the turn buttons inside a very short timeline and below its top fade. +const TIMELINE_MINIMAP_MAX_HEIGHT_CSS = + "min(max(4rem, calc(100% - 14.75rem)), calc(100% - 6.25rem))"; const TIMELINE_MINIMAP_PERSISTENT_GUTTER = 48; export interface WorkGroupScrollAnchor { @@ -481,17 +483,26 @@ export function resolveTimelineMinimapHasPersistentGutter( const TIMELINE_MINIMAP_HIT_STRIP_LEFT = 12; const TIMELINE_MINIMAP_HIT_STRIP_MAX_WIDTH = 40; +// The turn buttons reach this far left of the rail. The minimap renders inside the +// scroller, which clips its scrollbar gutter, so a wide classic gutter pushes it right. +const TIMELINE_MINIMAP_BUTTON_OVERHANG = 6; +export const TIMELINE_MINIMAP_SHIFT_CSS = `max(0px, var(--chat-timeline-gutter, 0px) - ${TIMELINE_MINIMAP_HIT_STRIP_LEFT - TIMELINE_MINIMAP_BUTTON_OVERHANG}px)`; export function resolveTimelineMinimapHitStripWidth( viewportWidth: number, contentWidth: number, + scrollbarGutter: number, ): number { const sideGutter = resolveTimelineSideGutter(viewportWidth, contentWidth); + const shift = Math.max( + 0, + scrollbarGutter - (TIMELINE_MINIMAP_HIT_STRIP_LEFT - TIMELINE_MINIMAP_BUTTON_OVERHANG), + ); return Math.max( 0, Math.min( TIMELINE_MINIMAP_HIT_STRIP_MAX_WIDTH, - Math.floor(sideGutter) - TIMELINE_MINIMAP_HIT_STRIP_LEFT, + Math.floor(sideGutter) - TIMELINE_MINIMAP_HIT_STRIP_LEFT - shift, ), ); } diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsx index 5b8a92122c290..966c2fb0c6b66 100644 --- a/apps/web/src/components/chat/MessagesTimeline.tsx +++ b/apps/web/src/components/chat/MessagesTimeline.tsx @@ -1054,7 +1054,11 @@ const ConversationTimeline = memo(function ConversationTimeline({ setMinimapHasPersistentGutter((current) => current === nextHasPersistentGutter ? current : nextHasPersistentGutter, ); - setMinimapHitStripWidth(resolveTimelineMinimapHitStripWidth(viewportWidth, contentWidth)); + const scrollNode = listRef.current?.getScrollableNode(); + const scrollbarGutter = scrollNode ? (scrollNode.offsetWidth - scrollNode.clientWidth) / 2 : 0; + setMinimapHitStripWidth( + resolveTimelineMinimapHitStripWidth(viewportWidth, contentWidth, scrollbarGutter), + ); }; // Rows added, removed or rewrapped (chat width) change the content size, // which moves the scroll position, the overflow, and the content lane width. diff --git a/apps/web/src/components/chat/TimelineMinimap.tsx b/apps/web/src/components/chat/TimelineMinimap.tsx index 2989f078a5fde..aebe31d49e0cc 100644 --- a/apps/web/src/components/chat/TimelineMinimap.tsx +++ b/apps/web/src/components/chat/TimelineMinimap.tsx @@ -10,6 +10,7 @@ import { resolveTimelineMinimapNavigationInteractive, resolveTimelineMinimapTopPercent, TIMELINE_MINIMAP_MIN_ITEMS, + TIMELINE_MINIMAP_SHIFT_CSS, } from "./MessagesTimeline.logic"; import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; import { cn } from "~/lib/utils"; @@ -103,7 +104,7 @@ export function TimelineMinimap({ const minimap = (
-
+
+