Skip to content

Commit 55f4baa

Browse files
Fix scroll behavior for programmatic updates
Set programmaticScrollRef flag when adjusting scroll position to prevent auto-scroll from fighting user intent. Also use direct scrollTop assignment instead of scrollToLatest() for consistency. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
1 parent b5006b8 commit 55f4baa

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cli/src/hooks/use-scroll-management.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,11 @@ export const useChatScrollbox = (
160160
)
161161

162162
if (scrollbox.scrollTop > maxScroll) {
163+
programmaticScrollRef.current = true
163164
scrollbox.scrollTop = maxScroll
164165
} else if (autoScrollEnabledRef.current) {
165-
scrollToLatest()
166+
programmaticScrollRef.current = true
167+
scrollbox.scrollTop = maxScroll
166168
}
167169
}, 50)
168170

0 commit comments

Comments
 (0)