Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple menu items become active

See original GitHub issue


  • BootstrapVue v1.2.0
  • Bootstrap v4b2
  • Nuxt v1.0.0- rc11

Nuxt application, For example… Suppose there is a product, product history, cart page.

├── index.vue
├── cart/
│   └── index.vue
└── products/
    ├── index.vue
    └── history.vue
<b-nav-item-dropdown text="Pages">
  <b-dropdown-item to="/products">Products</b-dropdown-item>
  <b-dropdown-item to="/cart">Cart</b-dropdown-item>
  <b-dropdown-item to="/products/history">History</b-dropdown-item>

Access the product page and open the menu. As expected.

Access the cart page and open the menu. As expected.

Access the product history page and open the menu. It is different from expectation. “Products” item should not be active. Should not the active class be an exact match rather than a partial match of the route URL?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

mosinvecommented, Nov 23, 2017

There’s a prop, named exact . This is what you should use. Please, read following:

Your example will be:

<b-nav-item-dropdown text="Pages">
  <b-dropdown-item :to="{ path: '/products' }" exact>Products</b-dropdown-item>
  <b-dropdown-item :to="{ path: '/cart' }" exact>Cart</b-dropdown-item>
  <b-dropdown-item :to="{ path: '/products/history' }" exact>History</b-dropdown-item>
mosinvecommented, Nov 23, 2017

You’re welcome! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Active menu trail for multiple menu item with the same path
When you add a new rule, just choose the option Mark the rule's parent menu item as being "active" on the settings page....
Read more >
Wrong active trail with multiple menu items with the same path
When the same path is added multiple times to the menu, then the menu active trail is determined by the first menu link...
Read more >
Change Active Menu Item on Scroll with Multiple Menus
The problem arises in that I have multiple menus that are visible at different screen sizes. I'm struggling with a way to change...
Read more >
Multiple menu items are being highlighted as current page #18
Issue: When the menu item for a custom post type archive (archive-karriar.php) is active, then also the blog menu item (home.php or index.php...
Read more >
Menu Styling | Web Accessibility Initiative (WAI) - W3C
Convey menu items and their states by using color and other styling options. Don't rely on color alone as some users will be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found