Make more robust

This commit is contained in:
Niek van der Maas 2023-03-22 09:40:25 +01:00
parent 8865b5095d
commit 1cea77fbb8
2 changed files with 2 additions and 3 deletions

View File

@ -26,7 +26,7 @@
<div class="column is-one-fifth"> <div class="column is-one-fifth">
<Sidebar bind:apiKey bind:sortedChats /> <Sidebar bind:apiKey bind:sortedChats />
</div> </div>
<div class="column is-four-fifths"> <div class="column is-four-fifths" id="content">
{#key $location} {#key $location}
<Router {routes} /> <Router {routes} />
{/key} {/key}

View File

@ -162,8 +162,7 @@
// Scroll to the bottom of the chat on update // Scroll to the bottom of the chat on update
afterUpdate(() => { afterUpdate(() => {
// Scroll to the bottom of the page after any updates to the messages array // Scroll to the bottom of the page after any updates to the messages array
const chatWindow = document.getElementsByClassName('column is-four-fifths')[0] document.querySelector('#content')?.scrollIntoView({ behavior: 'smooth', block: 'end' })
chatWindow.scrollIntoView({ behavior: 'smooth', block: 'end' })
input.focus() input.focus()
}) })