[Bug]: Navigation back to parent directory fails to restore scroll position in Files app (VirtualList resets to index 1)
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with VirtualList.vue around lines 220 and 261 and FilesList.vue around lines 334 and 414, then reproduce the issue with a large directory and browser console logging enabled. Trace the directory-change and content-fetch sequence, focusing on the skipped index 62 attempt and the later index 1 scroll. Done means returning to the parent restores the previously visited folder's position instead of the top.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100