Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick H. Lauke <redux@splintered.co.uk>2014-07-15 14:39:27 +0400
committerHeinrich Fenkart <hnrch02@gmail.com>2014-09-09 03:19:20 +0400
commitfb1ca10b99edc0f92eddd68b840f021da942afe9 (patch)
treeb4bbbbd2d9b2b4d1af3d34a9922b8e66ace4df6b /js/collapse.js
parent9702579aeb3f0aeb677631782c2920d6cd804475 (diff)
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.
Diffstat (limited to 'js/collapse.js')
-rw-r--r--js/collapse.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/js/collapse.js b/js/collapse.js
index f96be28607..6a8377615e 100644
--- a/js/collapse.js
+++ b/js/collapse.js
@@ -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)