]> source.dussan.org Git - jquery-ui.git/commitdiff
Accordion: set aria-selected to true on selected header, false on others. Fixed ...
authorRichard Worth <rdworth@gmail.com>
Tue, 15 Mar 2011 08:52:24 +0000 (04:52 -0400)
committerRichard Worth <rdworth@gmail.com>
Tue, 15 Mar 2011 08:52:24 +0000 (04:52 -0400)
tests/unit/accordion/accordion_core.js
ui/jquery.ui.accordion.js

index 2bef43149b9e156b653a583f9da47ccee94e116f..2d27f3bc0c5e72d371508591e5f55c08cf9bbfdf 100644 (file)
@@ -14,7 +14,7 @@ test("handle click on header-descendant", function() {
 });
 
 test("accessibility", function () {
-       expect(9);
+       expect(13);
        var ac = $('#list1').accordion().accordion("activate", 1);
        var headers = $(".ui-accordion-header");
 
@@ -25,9 +25,13 @@ test("accessibility", function () {
        equals( headers.next().attr("role"), "tabpanel", "tabpanel roles");
        equals( headers.eq(1).attr("aria-expanded"), "true", "active tab has aria-expanded");
        equals( headers.eq(0).attr("aria-expanded"), "false", "inactive tab has aria-expanded");
+       equals( headers.eq(1).attr("aria-selected"), "true", "active tab has aria-selected");
+       equals( headers.eq(0).attr("aria-selected"), "false", "inactive tab has aria-selected");
        ac.accordion("activate", 0);
        equals( headers.eq(0).attr("aria-expanded"), "true", "newly active tab has aria-expanded");
        equals( headers.eq(1).attr("aria-expanded"), "false", "newly inactive tab has aria-expanded");
+       equals( headers.eq(0).attr("aria-selected"), "true", "active tab has aria-selected");
+       equals( headers.eq(1).attr("aria-selected"), "false", "inactive tab has aria-selected");
 });
 
 })(jQuery);
index aac9a489198214768dee80d1146b30bd76695cf7..9419089b5c652f6f014a2c57dbf0c3de50a51cb9 100644 (file)
@@ -114,6 +114,7 @@ $.widget( "ui.accordion", {
                        .not( self.active || "" )
                        .attr({
                                "aria-expanded": "false",
+                               "aria-selected": "false",
                                tabIndex: -1
                        })
                        .next()
@@ -126,6 +127,7 @@ $.widget( "ui.accordion", {
                        self.active
                                .attr({
                                        "aria-expanded": "true",
+                                       "aria-selected": "true",
                                        tabIndex: 0
                                });
                }
@@ -173,6 +175,7 @@ $.widget( "ui.accordion", {
                        .removeClass( "ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
                        .removeAttr( "role" )
                        .removeAttr( "aria-expanded" )
+                       .removeAttr( "aria-selected" )
                        .removeAttr( "tabIndex" );
 
                this.headers.find( "a" ).removeAttr( "tabIndex" );
@@ -477,12 +480,14 @@ $.widget( "ui.accordion", {
                toHide.prev()
                        .attr({
                                "aria-expanded": "false",
+                               "aria-selected": "false",
                                tabIndex: -1
                        })
                        .blur();
                toShow.prev()
                        .attr({
                                "aria-expanded": "true",
+                               "aria-selected": "true",
                                tabIndex: 0
                        })
                        .focus();