Skip to content

Commit

Permalink
Fix bug twbs#20027
Browse files Browse the repository at this point in the history
How to Fix Multiple Tabs can become .active at once twbs#20027

Original Fix here in this js:
https://www.dropbox.com/s/eg235dwr8clpny8/bootstrap.js?dl=0

I changed var into let. I do not know if this is the way to do it. Please check it.
  • Loading branch information
Manuellama committed Jun 4, 2016
1 parent 10ce366 commit 590b5d2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions js/src/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ const Tab = (($) => {
// public

show() {
let tablist = this._element.closest('.nav-tabs');
if (tablist.getAttribute('role') == 'tablist') {
$(tablist).find('.active').removeClass('active');
}
if (this._element.parentNode &&
(this._element.parentNode.nodeType === Node.ELEMENT_NODE) &&
($(this._element).hasClass(ClassName.ACTIVE))) {
Expand Down Expand Up @@ -192,8 +196,13 @@ const Tab = (($) => {
}

active.setAttribute('aria-expanded', false)
}

}
for (let i = 0; i < element.parentNode.children.length; i++) {
let tab = element.parentNode.children[i];
if (tab.getAttribute('role') == 'tab') {
$(tab).removeClass(ClassName.ACTIVE);
}
}
$(element).addClass(ClassName.ACTIVE)
element.setAttribute('aria-expanded', true)

Expand Down

0 comments on commit 590b5d2

Please sign in to comment.