From b85f3d295f7c444f7ea2ce8d4cb9d2d8f29e366a Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 31 Jan 2024 20:11:58 +0100 Subject: [PATCH] fix(files): Do not scroll if there is no scrolling area Signed-off-by: Ferdinand Thiessen --- apps/files/src/components/VirtualList.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/files/src/components/VirtualList.vue b/apps/files/src/components/VirtualList.vue index d6508df103280..173fe284d27a0 100644 --- a/apps/files/src/components/VirtualList.vue +++ b/apps/files/src/components/VirtualList.vue @@ -243,6 +243,11 @@ export default Vue.extend({ methods: { scrollTo(index: number) { + const targetRow = Math.ceil(this.dataSources.length / this.columnCount) + if (targetRow < this.rowCount) { + logger.debug('VirtualList: Skip scrolling. nothing to scroll', { index, targetRow, rowCount: this.rowCount }) + return + } this.index = index // Scroll to one row and a half before the index const scrollTop = (Math.floor(index / this.columnCount) - 0.5) * this.itemHeight + this.beforeHeight