diff options
author | Alexander Schmitz <arschmitz@gmail.com> | 2015-08-24 09:32:13 -0400 |
---|---|---|
committer | Alexander Schmitz <arschmitz@gmail.com> | 2015-09-11 08:36:41 -0400 |
commit | e021e4d6e22dff80ec3a8ba84266508d34944a35 (patch) | |
tree | bdc141ce43ac9e0ac1889fea01b736edf0279eb2 /ui/widgets | |
parent | 14b3b607e53aa7c6a186e23be554911d5a56d1f7 (diff) | |
download | jquery-ui-e021e4d6e22dff80ec3a8ba84266508d34944a35.tar.gz jquery-ui-e021e4d6e22dff80ec3a8ba84266508d34944a35.zip |
Widget: Style updates
Ref #14246
Diffstat (limited to 'ui/widgets')
-rw-r--r-- | ui/widgets/accordion.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/ui/widgets/accordion.js b/ui/widgets/accordion.js index 8c16df38f..78fea52b1 100644 --- a/ui/widgets/accordion.js +++ b/ui/widgets/accordion.js @@ -87,6 +87,7 @@ return $.widget( "ui.accordion", { } this._processPanels(); + // handle negative values if ( options.active < 0 ) { options.active += this.headers.length; @@ -147,6 +148,7 @@ return $.widget( "ui.accordion", { _setOption: function( key, value ) { if ( key === "active" ) { + // _activate() will handle invalid values and update this.options this._activate( value ); return; @@ -238,21 +240,27 @@ return $.widget( "ui.accordion", { if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) { options.active = false; this.active = $(); + // active false only when collapsible is true } else if ( options.active === false ) { this._activate( 0 ); + // was active, but active panel is gone } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) { + // all remaining panel are disabled if ( this.headers.length === this.headers.find( ".ui-state-disabled" ).length ) { options.active = false; this.active = $(); + // activate previous panel } else { this._activate( Math.max( 0, options.active - 1 ) ); } + // was active, active panel still exists } else { + // make sure active index is correct options.active = this.headers.index( this.active ); } @@ -427,8 +435,10 @@ return $.widget( "ui.accordion", { event.preventDefault(); if ( + // click on active header, but not collapsible ( clickedIsActive && !options.collapsible ) || + // allow canceling activation ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { return; @@ -487,6 +497,7 @@ return $.widget( "ui.accordion", { "aria-selected": "false", "aria-expanded": "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 @@ -531,6 +542,7 @@ return $.widget( "ui.accordion", { if ( typeof options === "string" ) { easing = options; } + // fall back from options to animation in case of partial down settings easing = easing || options.easing || animate.easing; duration = duration || options.duration || animate.duration; |