Skip to content

[Bug]: Navigation back to parent directory fails to restore scroll position in Files app (VirtualList resets to index 1) #57505

@htcnokia

Description

@htcnokia

⚠️ This issue respects the following points: ⚠️

Bug description

When navigating back from a subfolder to a parent directory, the Files app fails to remember and restore the previous scroll position. Even though the system appears to trigger a scroll event, it incorrectly targets index 1 or scrollTop: 22, forcing the view back to the top of the list. This is particularly problematic in large directories (e.g., 100+ files).

Steps to reproduce

Open a folder with a large number of items (enough to require scrolling).

Scroll down and click on a folder (e.g., located at index 60).

Click the "Back" button or use the breadcrumbs to return to the parent directory.

Observe that the list resets to the very top instead of highlighting or scrolling to the folder you just exited.

Expected behavior

The view should automatically scroll back to the folder that was previously accessed, maintaining the user's context in the file list.

Nextcloud Server version

32

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.4

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

Monitoring the browser console during navigation reveals a race condition or a logic error in VirtualList.vue and FilesList.vue.

When returning to the parent directory, the VirtualList attempts to scroll before the content is fully rendered or uses an incorrect index:

Plaintext

FilesList.vue:334 [DEBUG] files: Directory changed {..., newDir: '/Parent', oldDir: '/Parent/Subfolder'}
...
VirtualList.vue:220 [DEBUG] files: VirtualList: Skip scrolling, nothing to scroll {..., index: 62, totalRows: 0}
...
FilesList.vue:414 [DEBUG] files: Fetched contents {..., totalRows: 141}
...
VirtualList.vue:261 [DEBUG] files: VirtualList: scrolling to index 1 {..., scrollTop: 22}
Observations:

The initial scroll attempt (Index 62) is skipped because totalRows is 0 (content not yet loaded).

After contents are fetched, the system incorrectly issues a scroll command to index 1 with a scrollTop of 22, effectively pinning the view to the top.

List of activated Apps

Nextcloud Signing status

Nextcloud Logs

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap32-feedbackbug

    Type

    Projects

    Status

    Triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions