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
Collapse Parent Grouping does not work inside a parent container with a "collapse" class #34850
Comments
@BenjaminWKI please move this code into a code pen example and attach the link here |
Thank you for transferring it. Try the snippet below <div id="parentGroup" class="accordion">
<div id="parentHeader" class="accordion-header">
<a href="#parentContent" data-bs-toggle="collapse" role="button" class="accordion-toggle">Parent</a>
</div>
<div id="parentContent" class="accordion-collapse collapse" aria-labelledby="parentHeader" data-bs-parent="#parentGroup">
<div class="accordion-body">
<div id="childGroup" class="accordion">
<div class="accordion-item">
<div id="childHeader1" class="accordion-header">
<a href="#childContent1" data-bs-toggle="collapse" role="button" class="accordion-toggle">Child 1</a>
</div>
<div id="childContent1" class="accordion-collapse collapse" aria-labelledby="childHeader1" data-bs-parent="#childGroup">
<div class="card-body">
<ul class="list-group">
<li class="list-group-item"><a id="#indexLink_slideID1" href="javascript:showSlide();">Slide 1</a></li>
<li class="list-group-item"><a id="#indexLink_slideID2" href="javascript:showSlide();">Slide 2</a></li>
</ul>
</div>
</div>
</div>
<div class="accordion-item">
<div id="childHeader2" class="accordion-header">
<a href="#childContent2" data-bs-toggle="collapse" role="button" class="accordion-toggle">Child 2</a>
</div>
<div id="childContent2" class="accordion-collapse collapse" aria-labelledby="childHeader2" data-bs-parent="#childGroup">
<div class="card-body">
<ul class="list-group">
<li class="list-group-item"><a id="#indexLink_slideID3" href="javascript:showSlide();">Slide 3</a></li>
<li class="list-group-item"><a id="#indexLink_slideID4" href="javascript:showSlide();">Slide 4</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div> |
Hi GeoSot, |
Hi @GeoSot , I agree with @BenjaminWKI, there is a bug. The behavior of nested collapsibles with parents presents some bug since the v5 of Bootstrap. I have created 2 Code Pen with your snippet to show you the problem:
|
@GeoSot I believe line 275 in collapse.js is missing the :scope pseudo-class at the start of ".collapse .collapse", as we want to be in the context of the parent accordion. |
@bewards Many Many thanks. You saved me some time of searching |
@GeoSot what's the timeline around release v5.1.2? I couldn't find release timeframes anywhere and didn't know if it followed the typical 2 week sprints. |
It would be a nice idea to follow the " typical 2 weeks sprints", however I do not have this knowledge too |
Using Bootstrap 5.1 with my demonstration code below, the grouped "Child 1" and "Child 2" accordions refuse to hide the other when one is being opened.
The moment you remove the "collapse" class from the "parentContent" div container, the grouping works.
https://codepen.io/BenjaminWKI/pen/rNwxbBO
The text was updated successfully, but these errors were encountered: