Skip to content

SidebarItem loses active state when navigating between pages #88

Description

@Zhengqbbb
CleanShot.2026-08-13.at.18.13.58-converted.mp4

What's wrong

When navigating between pages using the sidebar, if the target sidebar item is outside the currently visible area, the sidebar resets its entire state instead of focusing/scrolling the active SidebarItem into view.

Interestingly, this only happens during client-side navigation. The sidebar behaves correctly when the URL is opened in a new tab or when the link is opened normally.

Reproduction

  1. Scroll the sidebar so that the target SidebarItem is outside the visible area.
  2. Click a sidebar link to navigate to that page.
  3. Observe that the sidebar resets its state instead of scrolling the active SidebarItem into view.

Environment

nimbus-docs official website

Proposed fix (optional)

Cases that work correctly. The sidebar correctly focuses the active SidebarItem when:

  1. Copying the URL and opening it in a new tab.
  2. Opening the link normally.
  3. Loading the page directly.

There should be some logic here to trigger it again or handle the transition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions