-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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’s aria-expanded
attribute never leaves true
state.
#40841
Comments
Thanks for reporting an issue @mwaibel-go <h1
aria-expanded="false"
role="button"
- data-bs-target="#collapse-demo .collapse"
+ data-bs-target="#collapse-demo #test"
data-bs-toggle="collapse">
Collapse trigger
</h1>
<div class="expanded-true">aria-expanded = true</div>
<div class="expanded-false">aria-expanded = false</div>
- <div class="collapse">to be hidden</div>
+ <div class="collapse" id="test">to be hidden</div> That could be explained by the fact that the |
You’re right. When I debugged this, I didn’t notice that the What seems to happen is this (quoting collapse.js, ll. 183–191)
So now I know how to work around my specific issue, but I still think it’s odd to skip First the |
I'm glad the workaround was helpful! I'll keep this issue open so we can explore it further. Thanks for your detailed response 🙏. |
Prerequisites
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 thediv.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
The text was updated successfully, but these errors were encountered: