Collapse’s `aria-expanded` attribute never leaves `true` state.
Nobody has claimed this yet.
- Dominant language
- MDX
- Stars
- 175k
- Forks
- 78.6k
- Avg merge
- 7h 19m
- Merged PRs (30d)
- 35
Description
Prerequisites
- I have searched for duplicate or closed issues
- I have validated any HTML to avoid common problems
- I have read the contributing guidelines
Describe the issue
When a Collapse trigger is clicked, it should update the trigger’s aria-expanded attribute from "true" to "false" and vice versa. The test case shows that only the change from "false" to "true" happens. The attribute never gets updated again when the trigger is clicked again.
Note that the change from "false" to "true" doesn’t happen either if the div.collapse is removed. This might be by design, but I think this is a bug, too. There might be nothing to display at the time the trigger is clicked, but IMHO, the element still got expanded and should reflect that.
The reason I care about this is because I show an icon to display if a collapsible element is currently collapsed. Similar to the demo, I update the icon in CSS based on the trigger’s aria-expanded attribute.
Reduced test cases
https://stackblitz.com/edit/stackblitz-starters-zhsmta?file=index.html
What operating system(s) are you seeing the problem on?
Linux
What browser(s) are you seeing the problem on?
Chrome, Firefox
What version of Bootstrap are you using?
5.3.3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reduced StackBlitz test case and trace the Bootstrap 5.3.3 Collapse trigger behavior in both Chrome and Firefox. Verify that repeated clicks toggle aria-expanded between true and false, including when the target div.collapse has been removed; the issue is done when the attribute consistently reflects the trigger state.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, html, javascript
- Domain
- accessibility, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100