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">
 | 
			
		||||
        <Sidebar bind:apiKey bind:sortedChats />
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="column is-four-fifths">
 | 
			
		||||
      <div class="column is-four-fifths" id="content">
 | 
			
		||||
        {#key $location}
 | 
			
		||||
          <Router {routes} />
 | 
			
		||||
        {/key}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -162,7 +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
 | 
			
		||||
    window.scrollTo(0, document.body.scrollHeight)
 | 
			
		||||
    document.querySelector('#content')?.scrollIntoView({ behavior: 'smooth', block: 'end' })
 | 
			
		||||
    input.focus()
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue