Skip to content

Commit

Permalink
fix(files): Do not scroll if there is no scrolling area
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Jan 29, 2024
1 parent f1f1ef9 commit face7a6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/files/src/components/VirtualList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit face7a6

Please sign in to comment.