Skip to content
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

Accordion not closing when implemented with anchor element and href attribute #25445

Closed
karkut opened this issue Jan 26, 2018 · 3 comments
Closed

Comments

@karkut
Copy link

karkut commented Jan 26, 2018

I was unable to find an open or closed issue reporting this behavior.

In v4.0.0, accordions that use anchor elements and the href attribute to target the collapsible element do not function as expected. The closing of other expanded elements does not occur.

I have a project written with v4.0.0-beta in which I wrote an accordion using this method. It stopped working with the bootstrap.js from v4.0.0. The functionality returns if I substitute the bootstrap.js from v4.0.0-beta. I've been unable to find the change in bootstrap.js that is causing this.

A reduced test case of the issue is demonstrated on the w3schools page for Bootstrap 4 collapse. https://www.w3schools.com/bootstrap4/bootstrap_collapse.asp https://www.w3schools.com/bootstrap4/tryit.asp?filename=trybs_collapsible_accordion&stacked=h
Under the accordion example, you will find that opening a div does not close other expanded divs. They have implemented the accordion using anchor elements with href attributes pointing at the collapsible elements.

I have been able to repeat this behavior on Chrome 63.0.3239.132 and Safari 11.0.1 running on macOS 10.12.6, as well as Safari iOS 11.2.2.

Apologies for any missing information, this is my first issue submission.

@Johann-S
Copy link
Member

They are error in those examples see : https://getbootstrap.com/docs/4.0/components/collapse/#accordion-example

@karkut
Copy link
Author

karkut commented Jan 26, 2018

My apologies for opening the issue, I have found the error.

In v4.0.0-beta, data-parent could be an attribute of the anchor/button and the accordion would function. In v4.0.0, I see that it must be an attribute of the .collapse element.

Cheers.

@RaghavKannan
Copy link

@karkut I am facing the same issue. In bootstrap 3 its working. I am using Bootstrap 4. My requirement is http://jsfiddle.net/nuNsp/1797/. How you fixed it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants