diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-05-24 15:46:22 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-05-24 15:46:22 -0400 |
commit | 6a48cda4588454acb71984874c88535dde922757 (patch) | |
tree | 7373af0e8e1af627e57146cf992b9ce016bdea3a /ui/jquery.ui.accordion.js | |
parent | 1af21ce27df1db7468d91f19f61423d2e9af4449 (diff) | |
download | jquery-ui-6a48cda4588454acb71984874c88535dde922757.tar.gz jquery-ui-6a48cda4588454acb71984874c88535dde922757.zip |
Accordion: Make sure there's always one header with tabindex=0. Fixes #8348 - Accordion: Collapsed accordion is removed from tab order.
Diffstat (limited to 'ui/jquery.ui.accordion.js')
-rw-r--r-- | ui/jquery.ui.accordion.js | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index f713d25b8..0f1455790 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -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", |