From 082ec99238cf6508caedc7919c5202fe1b8fd6c9 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 20 Feb 2026 00:12:50 +0000 Subject: [PATCH] Fix: guard onMessagesWheel against non-scrollable containers 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. --- apps/web/src/components/ChatView.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 90aee38189..20aba241b5 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -1140,7 +1140,10 @@ export default function ChatView({ threadId }: ChatViewProps) { }, []); const onMessagesWheel = useCallback((event: WheelEvent) => { if (event.deltaY < 0) { - shouldAutoScrollRef.current = false; + const el = messagesScrollRef.current; + if (el && el.scrollHeight > el.clientHeight) { + shouldAutoScrollRef.current = false; + } } }, []); useLayoutEffect(() => {