diff options
Diffstat (limited to 'ui/jquery.ui.accordion.js')
-rw-r--r-- | ui/jquery.ui.accordion.js | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index f713d25b8..856b3ba4b 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -389,9 +389,9 @@ $.widget( "ui.accordion", { toHide = active.next(), eventData = { oldHeader: active, - oldContent: toHide, + oldPanel: toHide, newHeader: collapsing ? $() : clicked, - newContent: toShow + newPanel: toShow }; event.preventDefault(); @@ -437,8 +437,8 @@ $.widget( "ui.accordion", { }, _toggle: function( data ) { - var toShow = data.newContent, - toHide = this.prevShow.length ? this.prevShow : data.oldContent; + var toShow = data.newPanel, + toHide = this.prevShow.length ? this.prevShow : data.oldPanel; // handle activating a panel during the animation for another activation this.prevShow.add( this.prevHide ).stop( true, true ); @@ -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", @@ -517,7 +524,7 @@ $.widget( "ui.accordion", { }, _toggleComplete: function( data ) { - var toHide = data.oldContent; + var toHide = data.oldPanel; toHide .removeClass( "ui-accordion-content-active" ) @@ -669,9 +676,19 @@ if ( $.uiBackCompat !== false ) { } if ( type === "beforeActivate" ) { - ret = _trigger.call( this, "changestart", event, data ); + ret = _trigger.call( this, "changestart", event, { + oldHeader: data.oldHeader, + oldContent: data.oldPanel, + newHeader: data.newHeader, + newContent: data.newPanel + }); } else if ( type === "activate" ) { - ret = _trigger.call( this, "change", event, data ); + ret = _trigger.call( this, "change", event, { + oldHeader: data.oldHeader, + oldContent: data.oldPanel, + newHeader: data.newHeader, + newContent: data.newPanel + }); } return ret; }; |