Tab Navigation always active

Topic: Tab Navigation always active

Christian Aichner pro asked 2 years ago

Describe the bug

All navigation links of all MDBNav pills are active, no matter the active prop given to MDBNavLink


My code:

<MDBNav pills color="primary" className="flex-column">
{, key) => {
        <MDBNavItem key={key}>
            active={this.state.activeItemInnerPills === key} 
            <MDBIcon icon={setting.icon} className="mr-2" /> {setting.title}

Regarding to this code, the class active should only be given, if this.state.activeItemInnerPills === key - which works perfectly fine.

A quick console.log confirms this:

enter image description here

However, the tab looks like this:

enter image description here

As you can see, every tab is active.

Taking a look at the HTML, the following sight worries me:

enter image description here

It looks like every navigation button is already active, and the active param only adds one additional active.

Expected behavior

Only the active item should have a class active.

Additional information

You can find the entire code on GitHub.

Checking MDB code for bug

I have no idea about the origin of this problem. According to the NavLink.js file in our GitLab, there should be no problem:

const { children, className, disabled, active, to, ...attributes } = props;
  const classes = classNames(
    disabled ? 'disabled' : 'Ripple-parent',
    active && 'active',

Therefore, "active" should only be a class, if the parameter active is true.

Cheers, Chris

Jakub Chmura staff premium answered 2 years ago


Yes, we have a solution for that. MDBNavLink is a NavLink from react-router by default. To change that just add to all buggy MDBNavLink prop link. After you do that MDBNavLink will be a normal link from the react-router library and everything should be alright. In near future, we want to provide an MDBLink component that you will be able to use instead MDBNavLink when you will need a normal link, but we need more time for that, but for now, as I told you can use just link property.

Best, Kuba

leecoop commented 2 years ago

Thanks, It works

Jakub Chmura staff premium commented 2 years ago

You're welcome.

Thank you very much for your feedback!

If there is anything else I could do for you do not hesitate to ask me. I'll be happy to help you.

Best Regards,

dzzonii commented 2 years ago

Thanks, works pretty fine!

Jakub Chmura staff premium answered 2 years ago


Thank you for your feedback and for finding the bug!

Your problem description will make it much easier for us to work on repairing nav component.

We will try to fix this as soon as possible.

Best regards.


Pavel Isel Pérez Pupo commented 2 years ago

Hi, in the meanwhile how do i solve this, i paid for this, it wasn't free, so "as soon as possible" is not enough when there is money in the middle so i need a exact date and time

Jakub Chmura staff premium commented 2 years ago

hi @Pavel Isel Pérez Pupo

We apologize for the inconvenience, we do everything in our power to release the solution as soon as possible. Best regards,


Christian Aichner pro commented 2 years ago

A temporary fix would be to remove all active classes using JavaScript, and then setting the active manually. This can be achieved by using React DOM References (like Ref={this.tab1}) and then removing all classes using removeAttribute("class") on this reference. Then setting the previous classes + active if used.

Best regards, Chris

Christian Aichner pro commented 2 years ago

@Jakub Chmura you already know the origin of the bug? You need any assistance in solving?

Jakub Chmura staff premium answered 2 years ago

Hi @Christian Aichner,

We know what's wrong with tabs/pills... components but we need to implement and test this fix. In this case, there was a problem with the react-router library. We've found that the problem only occurs locally. If you put the project on the web, everything should be ok.

We're currently working to resolve the issue. If your solution doesn't break anything in your project, you can use it until our fix.

Best regards,


leecoop answered 2 years ago

Hi, Is this issue going to be fixed soon?

Jakub Chmura staff premium commented 2 years ago

Tabs and pills have been fixed and wrapped by new MDB Link component: Check this

Best, Kuba



Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.21.0
  • Device: Desktop
  • Browser: Google Chrome
  • OS: Windows 10 Professional
  • Provided sample code: No
  • Provided link: Yes