diff options
Diffstat (limited to 'apps/files/src/components/FilesListVirtual.vue')
-rw-r--r-- | apps/files/src/components/FilesListVirtual.vue | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/files/src/components/FilesListVirtual.vue b/apps/files/src/components/FilesListVirtual.vue index 5719f361680..5aff5f92316 100644 --- a/apps/files/src/components/FilesListVirtual.vue +++ b/apps/files/src/components/FilesListVirtual.vue @@ -259,18 +259,17 @@ export default Vue.extend({ event.preventDefault() event.stopPropagation() - // If reaching top, scroll up - const firstVisible = this.$refs.table?.$el?.querySelector('.files-list__row--visible') as HTMLElement - const firstSibling = firstVisible?.previousElementSibling as HTMLElement - if ([firstVisible, firstSibling].some(elmt => elmt?.contains(event.target as Node))) { + const tableTop = this.$refs.table.$el.getBoundingClientRect().top + const tableBottom = tableTop + this.$refs.table.$el.getBoundingClientRect().height + + // If reaching top, scroll up. Using 100 because of the floating header + if (event.clientY < tableTop + 100) { this.$refs.table.$el.scrollTop = this.$refs.table.$el.scrollTop - 25 return } // If reaching bottom, scroll down - const lastVisible = [...(this.$refs.table?.$el?.querySelectorAll('.files-list__row--visible') || [])].pop() as HTMLElement - const nextSibling = lastVisible?.nextElementSibling as HTMLElement - if ([lastVisible, nextSibling].some(elmt => elmt?.contains(event.target as Node))) { + if (event.clientY > tableBottom - 50) { this.$refs.table.$el.scrollTop = this.$refs.table.$el.scrollTop + 25 } }, |