Skip to content

Commit

Permalink
Accordion: Make sure there's always one header with tabindex=0. Fixes…
Browse files Browse the repository at this point in the history
… #8348 - Accordion: Collapsed accordion is removed from tab order.
  • Loading branch information
scottgonzalez committed May 24, 2012
1 parent 1af21ce commit 6a48cda
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions ui/jquery.ui.accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,16 +453,23 @@ $.widget( "ui.accordion", {
this._toggleComplete( data );
}

toHide
.attr({
"aria-expanded": "false",
"aria-hidden": "true"
toHide.attr({
"aria-expanded": "false",
"aria-hidden": "true"
});
toHide.prev().attr( "aria-selected", "false" );
// if we're switching panels, remove the old header from the tab order
// if we're opening from collapsed state, remove the previous header from the tab order
// if we're collapsing, then keep the collapsing header in the tab order
if ( toShow.length && toHide.length ) {
toHide.prev().attr( "tabIndex", -1 );
} else if ( toShow.length ) {
this.headers.filter(function() {
return $( this ).attr( "tabIndex" ) === 0;
})
.prev()
.attr({
"aria-selected": "false",
tabIndex: -1
});
.attr( "tabIndex", -1 );
}

toShow
.attr({
"aria-expanded": "true",
Expand Down

0 comments on commit 6a48cda

Please sign in to comment.