question-mark
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.

active-class on nav-item not working

See original GitHub issue

Hello.

We have updated to latest BootstrapVue version (rc13) and noticed, that active-class for b-nav-item stopped working. This is also reproducible on documentation pages and https://jsfiddle.net/n4ekygf8/. I checked with Firefox(65.0.2) and Chrome(72.0.3626.119). I am not a Vue or bootstrap expert, but before it worked as expected 😃

Best, Zakhar

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tmorehousecommented, Mar 5, 2019

Also note, the active-class is only applied if you are using vue-router and there is a to prop on the component (the docs are running under Nuxt, which uses vue-router under the hood).

Vue-router (not BootstrapVue) applies the active class when the to prop path/location matches the current route/page url.

See updated fiddle: https://jsfiddle.net/ozu2ny58/

0reactions
tmorehousecommented, Mar 6, 2019

The reason it was working before was that you were taking advantage of a bug in <b-nav-item> in how the vue-router active-class prop was being used/applied.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap navbar Active State not working - Stack Overflow
I use the class="active" on my navbar and it does not switch when I press menu items. I know how to do this...
Read more >
Active state not working in Bootstrap menu
Solved: Hi, I am trying to set up a simple Bootstrap menu it works fine except the Active component doesn't work.
Read more >
How to set active class to nav menu from bootstrap
To set the active class to the navigation menu dynamically by scrolling or clicking on the navigation links, the active class is to...
Read more >
How To Add Active Class To Current Element - W3Schools
Learn how to add an active class to the current element with JavaScript. Highlight the active/current (pressed) button: 1 2 3 4 5....
Read more >
Bootstrap Navbar Change Active Class Link - CodePen
Insecure Resource. The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https....
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found