fix: Correct chat auto-scroll to bottom by setting container's scrollTop property instead of using scrollIntoView.

This commit is contained in:
pradeepkumar committed 2026-03-19 08:45:09 +05:30
1 parent 3a5377dd35
commit 29574ef5d8
1 file changed
+5 -2
+5 -2
View File
@@ -138,9 +138,12 @@ export default function SupportChatPage() {
}; };
}, [chat, currentUserId]); }, [chat, currentUserId]);
// Auto-scroll to bottom on new messages // Auto-scroll to bottom on new messages (scroll container, not page)
useEffect(() => { useEffect(() => {
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' }); const container = messagesContainerRef.current;
if (container) {
container.scrollTop = container.scrollHeight;
}
}, [messages]); }, [messages]);
// Send message // Send message