blazorbootstrap icon indicating copy to clipboard operation
blazorbootstrap copied to clipboard

Bug in Sidebar Component: Multiple NavItems Considered Active

Open sdepouw opened this issue 1 year ago • 0 comments

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

sdepouw avatar Aug 27 '25 12:08 sdepouw