Merge pull request #62 from shivan2418/scroll_on_update_improvement
Improve scroll to bottom of page behavior
This commit is contained in:
commit
0aedc7e804
|
@ -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}
|
||||||
|
|
|
@ -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()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue