mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-09 07:06:36 +02:00
Fix collapse.js aria-expanded behavior
* Remove aria-expanded from collapse.js target element aria-expanded="true"/aria-expanded="false" only applies to the trigger, not the element that is being expanded/collapsed. * Tweak collapse.js accessibility section ...to make it clearer that the aria-expanded attribute always just goes on the control. * Fix collapse.js unit tests - reword some of the text to make it clear we're checking behavior of trigger/control - move incorrect aria-expanded out of the <div>s and to the actual trigger/control <a>s - fix incorrect test assertion text output false -> true
This commit is contained in:
@@ -162,7 +162,6 @@ const Collapse = (($) => {
|
||||
.addClass(ClassName.COLLAPSING)
|
||||
|
||||
this._element.style[dimension] = 0
|
||||
this._element.setAttribute('aria-expanded', true)
|
||||
|
||||
if (this._triggerArray.length) {
|
||||
$(this._triggerArray)
|
||||
@@ -223,8 +222,6 @@ const Collapse = (($) => {
|
||||
.removeClass(ClassName.COLLAPSE)
|
||||
.removeClass(ClassName.SHOW)
|
||||
|
||||
this._element.setAttribute('aria-expanded', false)
|
||||
|
||||
if (this._triggerArray.length) {
|
||||
$(this._triggerArray)
|
||||
.addClass(ClassName.COLLAPSED)
|
||||
@@ -300,7 +297,6 @@ const Collapse = (($) => {
|
||||
_addAriaAndCollapsedClass(element, triggerArray) {
|
||||
if (element) {
|
||||
const isOpen = $(element).hasClass(ClassName.SHOW)
|
||||
element.setAttribute('aria-expanded', isOpen)
|
||||
|
||||
if (triggerArray.length) {
|
||||
$(triggerArray)
|
||||
|
Reference in New Issue
Block a user