fix: Correct chat auto-scroll to bottom by setting container's scrollTop property instead of using scrollIntoView.
This commit is contained in:
@@ -138,9 +138,12 @@ export default function SupportChatPage() {
|
||||
};
|
||||
}, [chat, currentUserId]);
|
||||
|
||||
// Auto-scroll to bottom on new messages
|
||||
// Auto-scroll to bottom on new messages (scroll container, not page)
|
||||
useEffect(() => {
|
||||
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
|
||||
const container = messagesContainerRef.current;
|
||||
if (container) {
|
||||
container.scrollTop = container.scrollHeight;
|
||||
}
|
||||
}, [messages]);
|
||||
|
||||
// Send message
|
||||
|
||||
Reference in New Issue
Block a user