Skip to content

Bug in Sidebar Component: Multiple NavItems Considered Active #1166

@sdepouw

Description

@sdepouw

NOTE: We do not look at .zip attachments for issue investigation.

Describe the bug
We're using the Sidebar component with a DataProvider (just building a static list of elements). We have two nav items, with URLs like so:

  • /foo
  • /foo/bar

The Sidebar should add the active CSS class to indicate the current page, which it does. Here I am when I'm at /foo:

Image

However, if I'm on /foo/bar, both of these nav items are flagged as active, and thus both are shown as the current page, incorrectly:

Image

To Reproduce

Add two Nav Items to a Sidebar component instance, one with a URL such as /foo, another which has a URL such as /foo/bar. Visit the /foo/bar route.

Expected behavior

Only The /foo/bar nav item should be considered Active

Versions (please complete the following information):

  • .NET Version: .NET 9
  • BlazorBootstrap: 3.4.0

Desktop (please complete the following information):

  • OS: Windows 11, but reproduces in other environments (client/browser-agnostic)
  • Browser: Confirmed in Firefox and Edge

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions