From: Patrick H. Lauke Date: Tue, 15 Jul 2014 10:39:27 +0000 (+0100) Subject: ARIA support for collapse X-Git-Tag: v3.3.0~182 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb1ca10b99edc0f92eddd68b840f021da942afe9;p=thirdparty%2Fbootstrap.git 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. --- diff --git a/docs/_includes/js/collapse.html b/docs/_includes/js/collapse.html index 4e7fb450a6..5239256a62 100644 --- a/docs/_includes/js/collapse.html +++ b/docs/_includes/js/collapse.html @@ -17,7 +17,7 @@

- + Collapsible Group Item #1

@@ -31,7 +31,7 @@

- +

@@ -45,7 +45,7 @@

- +

@@ -63,7 +63,7 @@

- + Collapsible Group Item #1

@@ -77,7 +77,7 @@

- +

@@ -91,7 +91,7 @@

- +

@@ -107,13 +107,18 @@

You can also use the plugin without the accordion markup. Make a button toggle the expanding and collapsing of another element.

{% highlight html %} -
...
{% endhighlight %} +
+

Make expand/collapse controls accessible

+

Be sure to add aria-expanded to the control element. This attribute explicitly defines the current state of the collapsible element to screen readers and similar assistive technologies. If the collapsible element is closed by default, it should have a value of aria-expanded="false". If you've set the collapsible element to be open by default using the in class, set aria-expanded="true" on the control instead. The plugin will automatically toggle this attribute based on whether or not the collapsible element has been opened or closed.

+

Additionally, if your control element is targetting a single collapsible element – i.e. the data-target attribute is pointing to an id selector – you may add an additional aria-controls attribute to the control element, containing the id of the collapsible element. Modern screen readers and similar assistive technologies make use of this attribute to provide users with additional shortcuts to navigate directly to the collapsible element itself.

+

Usage

The collapse plugin utilizes a few classes to handle the heavy lifting:

@@ -125,7 +130,7 @@

These classes can be found in component-animations.less.

Via data attributes

-

Just add data-toggle="collapse" and a data-target to element to automatically assign control of a collapsible element. The data-target attribute accepts a CSS selector to apply the collapse to. Be sure to add the class collapse to the collapsible element. If you'd like it to default open, add the additional class in.

+

Just add data-toggle="collapse" and a data-target to the element to automatically assign control of a collapsible element. The data-target attribute accepts a CSS selector to apply the collapse to. Be sure to add the class collapse to the collapsible element. If you'd like it to default open, add the additional class in.

To add accordion-like group management to a collapsible control, add the data attribute data-parent="#selector". Refer to the demo to see this in action.

Via JavaScript

@@ -151,7 +156,7 @@ $('.collapse').collapse() parent selector false - If selector then all collapsible elements under the specified parent will be closed when this collapsible item is shown. (similar to traditional accordion behavior - this dependent on the panel class) + If a selector is provided, then all collapsible elements under the specified parent will be closed when this collapsible item is shown. (similar to traditional accordion behavior - this is dependent on the panel class) toggle diff --git a/docs/examples/carousel/index.html b/docs/examples/carousel/index.html index 193a92657e..3b185dcd92 100644 --- a/docs/examples/carousel/index.html +++ b/docs/examples/carousel/index.html @@ -35,7 +35,7 @@