Skip to content

Keep administration menu position when switching admin items - #2138

Open
jay23606 wants to merge 1 commit into
DependencyTrack:mainfrom
jay23606:pr-go/2108-administration-clicking-a-menu-item-scro
Open

jay23606 wants to merge 1 commit into
DependencyTrack:mainfrom
jay23606:pr-go/2108-administration-clicking-a-menu-item-scro

Conversation

@jay23606

Copy link
Copy Markdown

Problem

On the Administration page, clicking an item in the left-hand menu (for example Access Management → Teams, then Permissions) scrolls the whole page back to the top. The menu scrolls with the page, so the user loses their place in the menu after every click.

The router's scrollBehavior only exempted /dependencyGraph navigations from resetting the scroll position. Admin items are separate routes under /admin, so each one reset the scroll to the top.

Change

  • Move scrollBehavior into src/router/scrollBehavior.js so it can be tested without loading the whole router.
  • Skip the scroll reset when both the source and target routes are under /admin, the same way /dependencyGraph is exempted.
  • Add src/router/scrollBehavior.test.js covering the admin-to-admin case (no scroll) and the outside-to-admin case (scroll to top).

Testing

  • npx vitest run src/router/scrollBehavior.test.js: 2 tests pass.
  • npx prettier --check src/router: passes.
  • npx eslint src/router: passes.
  • npx vitest run: all 29 unit tests pass.
  • Not run here: the browser/E2E suite and a manual check in a browser.

Fixes #2108

@jay23606
jay23606 force-pushed the pr-go/2108-administration-clicking-a-menu-item-scro branch from 6c436a4 to 6a85cf2 Compare November 22, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Administration: clicking a menu item scrolls the page to the top, losing the place in the admin menu

1 participant