-
-
Notifications
You must be signed in to change notification settings - Fork 79k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tabs: fix nested tabs. #23087
tabs: fix nested tabs. #23087
Conversation
...and tests fail :D |
Test failed because with this change this line : previous = $.makeArray($(listElement).find(Selector.ACTIVE)) Retrieve nothing, so we are unable to find previous active items |
I should probably also add a test for my use case that currently fails. @Johann-S: feel free to push to this branch if you have any ideas. |
7f83e70
to
8f835df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Unless @XhmikosR want to add another unit test here
Slating this for Beta 2. Thanks for tackling it! |
We're going to have things we've broken in the beta—we won't have a perfect ship—and this isn't critical IMO. The remaining time ahead of Beta 1 should be spent on ensuring nothing that is current broken (or working hah) needs a backwards incompatible change. |
This fix is also not good for my nested tabs. I stick with
from alpha 6 tabs. |
I'll check that thank you @danijelGombac for the feedback 👍 |
I made different tabs with collapse inside. Maybe i should make different codepen. |
It seems it works pretty well here : https://codepen.io/Johann-S/pen/zzQEje |
Later i make a codepen, so you can see what is wrong and if tabs will support this type of approach. |
Yes do not hesitate to provide a reduce test case @danijelGombac 👍 |
Tabs with collapse. Look Product discounts tab. There is also problem with bg colors. |
I made a fix for your issue @danijelGombac but I didn't handled the problem with background colors |
Ok, i will test it. The background color problem lies in this part of code:
Come out:
And when collapse became collapse.show change all .nav-links. |
Maybe this CSS issue should be solved in an other PR |
I try your code, but still something not working well. You can see in the last two tabs. When you click the last two tabs and then the tab with collapse, they remain active and from the tabs in collapse the active state is removed. |
b838f32
to
963721e
Compare
I made a new commit @danijelGombac which should fix your issue 😉 |
I try the code and seems to work fine. 👍 |
963721e
to
f5e63d7
Compare
I made a bit of refactorization here : let activeElements
if (callback === undefined) {
if (container.nodeName === 'UL') {
activeElements = $(container).find(Selector.ACTIVE_UL)
} else {
activeElements = $(container).find(Selector.ACTIVE)
}
} else {
activeElements = $(container).children(Selector.ACTIVE)
} changed to : let activeElements
if (container.nodeName === 'UL') {
activeElements = $(container).find(Selector.ACTIVE_UL)
} else {
activeElements = $(container).children(Selector.ACTIVE)
} I played every CodePen submited by @danijelGombac and everythings works fine, Unit tests passed, if you have time @XhmikosR to check on your personal use case too it would be great 👍 |
@Johann-S: there's a regression somewhere again, I'll ping you on Slack. |
@mdo we have a question (@XhmikosR and myself) about our Tabs plugins, we aren't sure if our Tabs plugin should handle a markup like this with the <ul class="nav nav-tabs nav-justified" role="tablist">
<li class="nav-item">
<a href="#home" class="nav-link" role="tab" data-toggle="tab">Home</a>
</li>
<li class="nav-item active">
<a href="#options" class="nav-link" role="tab" data-toggle="tab">Options</a>
</li>
<li class="nav-item">
<a href="#team" class="nav-link" role="tab" data-toggle="tab">Team</a>
</li>
</ul>
<div class="tab-content">
<div id="home" role="tabpanel" class="tab-pane fade">
Home
</div>
<div id="options" role="tabpanel" class="tab-pane fade show active">
Options
</div>
<div id="team" role="tabpanel" class="tab-pane fade">
Team
</div>
</div> @XhmikosR do not hesitate to add some details 👍 |
When one uses say a carousel inside a tab, the
.active
selector previously matches the carousel ones too leading to broken tabs.It's not the perfect solution but should the job for now.
/CC @Johann-S
PS. The
data-target
solution you suggested seems definitely better for the long term. I just don't have the time to implement it myself so I resorted to a quick fix for now :)Fixes #22654.