History

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.

Cursor Agent committed 8 months ago

Commit 082ec991 parent 0cb4e751 file · +4 −1Browse files

Unified · Split

apps/web/src/components/ChatView.tsx+4−1
@@ -1140,7 +1140,10 @@ export default function ChatView({ threadId }: ChatViewProps) { · 1139 unmodified lines
11401140 }, []);
11411141 const onMessagesWheel = useCallback((event: WheelEvent<HTMLDivElement>) => {
11421142 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+ }
11441147 }
11451148 }, []);
11461149 useLayoutEffect(() => {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t