From 1cea77fbb808c596441c9c62ea5ba397cce305b6 Mon Sep 17 00:00:00 2001 From: Niek van der Maas Date: Wed, 22 Mar 2023 09:40:25 +0100 Subject: [PATCH] Make more robust --- src/App.svelte | 2 +- src/lib/Chat.svelte | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index 5bcf594..58501e3 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -26,7 +26,7 @@
-
+
{#key $location} {/key} diff --git a/src/lib/Chat.svelte b/src/lib/Chat.svelte index dfc5535..27dad4d 100644 --- a/src/lib/Chat.svelte +++ b/src/lib/Chat.svelte @@ -162,8 +162,7 @@ // Scroll to the bottom of the chat on update afterUpdate(() => { // Scroll to the bottom of the page after any updates to the messages array - const chatWindow = document.getElementsByClassName('column is-four-fifths')[0] - chatWindow.scrollIntoView({ behavior: 'smooth', block: 'end' }) + document.querySelector('#content')?.scrollIntoView({ behavior: 'smooth', block: 'end' }) input.focus() })