Skip to content

Module navigation scroll position resets when navigating between pages #28268

Description

@khanahmad4527

Describe the Bug

When a project has enough collections for the module navigation to scroll, the navigation jumps back to the top on almost every navigation. If you scroll down to reach a collection near the bottom of the list, open it, and then want to go to a neighbouring collection, the list has already scrolled back to the top and you have to scroll down again.

The module navigation's scroll container lives inside PrivateView, which each route component mounts itself (app/src/modules/content/routes/collection.vue, item.vue, …). Any navigation that swaps the route component therefore destroys the scroll container and creates a new one at scrollTop: 0, and nothing persists the offset.

That means the reset happens on every navigation between different route records, not just within Content:

Navigation Nav scroll offset
collection list → another collection list (same route record) preserved
collection list → item detail reset to 0
item detail → another collection reset to 0
Content → Settings → Content reset to 0

To Reproduce

  1. Create enough collections that the module navigation scrolls (25 collections at a 1440×640 viewport is enough).
  2. Go to Content and open the first collection.
  3. Scroll the module navigation to the bottom.
  4. Open any item in the collection (or click a collection while an item detail page is open).
  5. The module navigation is back at the top.

Measured with Playwright against directus/directus:12.3.1, reading #module-navigation scrollTop before and after each navigation:

  OK   | collection list -> other collection: 310 -> 310
 RESET | item detail -> other collection: 310 -> 0
 RESET | collection list -> item detail (row click): 310 -> 0
 RESET | module switch: content -> settings -> content: 310 -> 0
  OK   | browser back after navigating away: 310 -> 310

Directus Version

v12.3.1

Hosting Strategy

Self-Hosted (Docker Image)

Database

SQLite 3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions