Skip to content

Tabs do not seem to be getting the .react-tabs__tab class applied #268

@rohan-deshpande

Description

@rohan-deshpande

I upgraded recently and have found that tabs don't seem to be getting the .react-tabs__tab base class applied.

Like if I look at the code I can see that you're just concatenating --selected or --disabled to DEFAULT_CLASS but is this correct? Shouldn't you be adding a class?

const DEFAULT_CLASS = 'react-tabs__tab';

export default class Tab extends Component {
  static defaultProps = {
    className: DEFAULT_CLASS,
    disabledClassName: `${DEFAULT_CLASS}--disabled`,
    focus: false,
    id: null,
    panelId: null,
    selected: false,
    selectedClassName: `${DEFAULT_CLASS}--selected`,
  };
...

In the css

.react-tabs__tab {
  display: inline-block;
  border: 1px solid transparent;
  border-bottom: none;
  bottom: -1px;
  position: relative;
  list-style: none;
  padding: 6px 12px;
  cursor: pointer;
}

.react-tabs__tab--selected {
  background: #fff;
  border-color: #aaa;
  color: black;
  border-radius: 5px 5px 0 0;
}

If you don't add .react-tabs__tab--selected or .react-tabs__tab--disabled as an extra class, then none of the tabs will get .react-tabs__tab and the tab styling will not be applied.

Not sure if this is a mistake or if this is the intention?

Update: hmm I guess cx is supposed to be applying all of them?

        className={cx(className, {
          [selectedClassName]: selected,
          [disabledClassName]: disabled,
        })}

It doesn't seem to be happening for me though, here's an example of a rendered tab

<li class="tab-subtasks react-tabs__tab--selected" role="tab" id="react-tabs-0" aria-selected="true" aria-disabled="false" aria-controls="react-tabs-1" tabindex="0">
  <i class="fa fa-check-circle"></i> <span class="tab-title">Subtasks</span> 
</li>

class="tab-subtasks react-tabs__tab--selected" notice how the .react-tabs__tab default class is not being added

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