Skip to content

Commit

Permalink
Update scrollElement var
Browse files Browse the repository at this point in the history
  • Loading branch information
kadiryazici committed Mar 17, 2024
1 parent a974f13 commit 94202cb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/AppScroller.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ const focus = batchFn(() => {
scrollView.value?.getElement()?.focus()
})
provide(scrollElementInjectionKey, computed(() => scrollView.value?.osInstance()?.elements()?.viewport as HTMLElement))
const scrollElement = computed(() => scrollView.value?.osInstance()?.elements()?.scrollOffsetElement as HTMLElement)
provide(scrollElementInjectionKey, scrollElement)
useTauriEvent('window:hidden', focus)
onMounted(focus)
watch(route.currentPage, () => {
focus()
const element = scrollView.value?.osInstance()?.elements().scrollOffsetElement
if (element) {
element.scrollTop = 0
if (scrollElement.value) {
scrollElement.value.scrollTop = 0
}
}, { flush: 'post' })
Expand Down

0 comments on commit 94202cb

Please sign in to comment.