From face7a6f68096fefc7ef8d358d73a64d9bad4f37 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 29 Jan 2024 16:08:48 +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 77454772f5554..1011b8a408560 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