diff --git a/packages/ui/src/components/chat/MessageList.tsx b/packages/ui/src/components/chat/MessageList.tsx index 746c3c05..58d2caae 100644 --- a/packages/ui/src/components/chat/MessageList.tsx +++ b/packages/ui/src/components/chat/MessageList.tsx @@ -1193,12 +1193,17 @@ const StaticHistoryList = React.memo(({ entries, engine, contentRef, scrollRef, if (engine === 'tanstack') { const virtualItems = tanstackVirtualizer.getVirtualItems(); const startOffset = virtualItems[0]?.start ?? 0; - // Rendered rows stay in normal flow inside a single translated wrapper - // (not per-row absolute positioning) so per-turn sticky user headers - // keep working against the scroll container. + // Rendered rows stay in normal flow inside a single offset wrapper (not + // per-row absolute positioning) so per-turn sticky user headers keep + // working against the scroll container. The offset MUST be padding, not + // transform: a transformed ancestor becomes the sticky containing block, + // so headers would stick to the wrapper's (arbitrary, overscan-dependent) + // top edge mid-list and float over the previous turn. Padding only + // changes when the virtual window shifts — not per scroll frame — so the + // layout cost is negligible. return (