mirror of
https://github.com/twbs/bootstrap.git
synced 2025-10-01 07:46:47 +02:00
ARIA support for collapse
Added handling of aria-expanded=true/false to collapse.js, updated documentation to include advice on making expand/collapse controls accessible, updated examples and javascript documentation to use aria-expanded and aria-controls (when targetting single collapsible element, using ID rather than class selector) Closes #14147. Closes #14153.
This commit is contained in:
committed by
Heinrich Fenkart
parent
9702579aeb
commit
fb1ca10b99
@@ -56,6 +56,7 @@
|
||||
this.$element
|
||||
.removeClass('collapse')
|
||||
.addClass('collapsing')[dimension](0)
|
||||
.attr('aria-expanded', true)
|
||||
|
||||
this.transitioning = 1
|
||||
|
||||
@@ -91,6 +92,7 @@
|
||||
this.$element
|
||||
.addClass('collapsing')
|
||||
.removeClass('collapse in')
|
||||
.attr('aria-expanded', false)
|
||||
|
||||
this.transitioning = 1
|
||||
|
||||
@@ -161,8 +163,9 @@
|
||||
var $parent = parent && $(parent)
|
||||
|
||||
if (!data || !data.transitioning) {
|
||||
if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
|
||||
$this.toggleClass('collapsed', $target.hasClass('in'))
|
||||
if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed').attr('aria-expanded', false)
|
||||
var isCollapsed = $target.hasClass('in')
|
||||
$this.toggleClass('collapsed', isCollapsed).attr('aria-expanded', !isCollapsed)
|
||||
}
|
||||
|
||||
Plugin.call($target, option)
|
||||
|
Reference in New Issue
Block a user