The wheel handler unconditionally set shouldAutoScrollRef to false on upward wheel events, even when the scroll container had no overflow. Since no scroll event fires in that case, auto-scroll stayed permanently disabled. Add a scrollHeight > clientHeight guard so the handler only disables auto-scroll when the container actually has scrollable content.
Unified · Split
| @@ -1140,7 +1140,10 @@ export default function ChatView({ threadId }: ChatViewProps) { · 1139 unmodified lines | ||
| 1140 | 1140 | }, []); |
| 1141 | 1141 | const onMessagesWheel = useCallback((event: WheelEvent<HTMLDivElement>) => { |
| 1142 | 1142 | if (event.deltaY < 0) { |
| 1143 | − shouldAutoScrollRef.current = false; | |
| 1143 | + const el = messagesScrollRef.current; | |
| 1144 | + if (el && el.scrollHeight > el.clientHeight) { | |
| 1145 | + shouldAutoScrollRef.current = false; | |
| 1146 | + } | |
| 1144 | 1147 | } |
| 1145 | 1148 | }, []); |
| 1146 | 1149 | useLayoutEffect(() => { |