diff --git a/src/lib/components/chat/Messages.svelte b/src/lib/components/chat/Messages.svelte index f805c83e3..1dbb3f19c 100644 --- a/src/lib/components/chat/Messages.svelte +++ b/src/lib/components/chat/Messages.svelte @@ -361,13 +361,14 @@ history: history }); - const element = document.getElementById('messages-container'); - autoScroll = - element.scrollHeight - element.scrollTop <= element.clientHeight + 50; - - setTimeout(() => { - scrollToBottom(); - }, 100); + if (autoScroll) { + const element = document.getElementById('messages-container'); + autoScroll = + element.scrollHeight - element.scrollTop <= element.clientHeight + 50; + setTimeout(() => { + scrollToBottom(); + }, 100); + } }} /> {/key}