Skip to content

Commit f296e5e

Browse files
committed
fix(files): Prevent file list from jumping when selecting visible files
Skip scrolling when a file is clicked if it's already within the visible viewport, avoiding the confusing list jump behavior. Fixes #54700 Signed-off-by: nfebe <fenn25.fn@gmail.com>
1 parent 9def7a8 commit f296e5e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

apps/files/src/components/VirtualList.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,13 @@ export default defineComponent({
336336
return
337337
}
338338
339+
// Skip scrolling if the target index is already visible
340+
const lastVisibleIndex = this.index + (this.visibleRows * this.columnCount) - 1
341+
if (index >= this.index && index <= lastVisibleIndex) {
342+
logger.debug('VirtualList: Skip scrolling, index already visible', { index })
343+
return
344+
}
345+
339346
// Check if the content is smaller (not equal! keep the footer in mind) than the viewport
340347
// meaning there is no scrollbar
341348
if (this.totalRowCount < this.visibleRows) {

0 commit comments

Comments
 (0)