Skip to content

Commit

Permalink
fix: #79 browser scrolling the editor into view on load
Browse files Browse the repository at this point in the history
  • Loading branch information
josdejong committed May 20, 2022
1 parent 42be0e7 commit 42fe818
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/lib/components/controls/navigationBar/NavigationBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
function scrollToLastItem() {
setTimeout(() => {
const lastItem = refNavigationBar && refNavigationBar.querySelector('div:last-child')
if (lastItem && lastItem.scrollIntoView) {
// debug('scroll to lastItem', path)
lastItem.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
if (refNavigationBar && refNavigationBar.scrollTo) {
const left = refNavigationBar.scrollWidth - refNavigationBar.clientWidth
if (left > 0) {
debug('scrollTo ', left)
refNavigationBar.scrollTo({ left, behavior: 'smooth' })
}
}
})
}
Expand Down

0 comments on commit 42fe818

Please sign in to comment.