Merge pull request #62 from shivan2418/scroll_on_update_improvement

Improve scroll to bottom of page behavior
This commit is contained in:
Niek van der Maas 2023-03-22 09:40:43 +01:00 committed by GitHub
commit 0aedc7e804
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 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,7 +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
window.scrollTo(0, document.body.scrollHeight) document.querySelector('#content')?.scrollIntoView({ behavior: 'smooth', block: 'end' })
input.focus() input.focus()
}) })