Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Issues
  • #37618
Closed
Open
Issue created Dec 09, 2022 by Administrator@rootContributor

Accordion page does not demonstrate JavaScript implementation

Created by: alexhorner

The Accordion page https://getbootstrap.com/docs/5.2/components/accordion/ does not have a Usage via JavaScript section like Modal and Collapse does.

Even though Accordion is documented to use Collapse under the hood, it is not clear how to construct a working Accordion using JavaScript. Using the Collapse JavaScript object's constructor on each of the Accordion elements breaks them, and it is not clear how to properly implement the Collapse.

Ideally, a Usage via JavaScript section would be added to Accordion explaining how to either construct an Accordion, or how to correctly construct a Collapse object such that all of the Accordion buttons and bodies work correctly, and when opening one Accordion segment, all other Accordion segments close, just like the non-JavaScript-created variant works right now.

This would be very useful for constructing a templated Accordion as a result of an XHR request. Right now, the result of creating a templated Accordion (with unique IDs as appropriate) is a non-functional Accordion.

I have not been able to find a workaround to this issue and I have ended up with a broken, non-functional Accordion with all bodies uncollapsed for now.

Assignee
Assign to
Time tracking