aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2012-06-12 10:07:16 -0400
committerScott González <scott.gonzalez@gmail.com>2012-06-12 10:07:16 -0400
commit9ebeb0616a5ca556e507aecbe360f5dcec238737 (patch)
tree0fc86adf4e16b37a3a3d39162bf6015fad06e744 /ui
parent9e805c0384133ad01969b6cee4e9bb294e8e4c00 (diff)
downloadjquery-ui-9ebeb0616a5ca556e507aecbe360f5dcec238737.tar.gz
jquery-ui-9ebeb0616a5ca556e507aecbe360f5dcec238737.zip
Tabs: Walk previous tabs (and loop) in refresh() in case the tab we're trying to activate is disabled.
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.tabs.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js
index 8c7bd207b..e71b2a244 100644
--- a/ui/jquery.ui.tabs.js
+++ b/ui/jquery.ui.tabs.js
@@ -229,7 +229,7 @@ $.widget( "ui.tabs", {
}
},
- _focusNextTab: function( index, goingForward ) {
+ _findNextTab: function( index, goingForward ) {
var lastTabIndex = this.tabs.length - 1;
function constrain() {
@@ -246,6 +246,11 @@ $.widget( "ui.tabs", {
index = goingForward ? index + 1 : index - 1;
}
+ return index;
+ },
+
+ _focusNextTab: function( index, goingForward ) {
+ index = this._findNextTab( index, goingForward );
this.tabs.eq( index ).focus();
return index;
},
@@ -309,9 +314,14 @@ $.widget( "ui.tabs", {
this.active = $();
// was active, but active tab is gone
} else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
+ // all remaining tabs are disabled
+ if ( this.tabs.length === options.disabled.length ) {
+ options.active = false;
+ this.active = $();
// activate previous tab
- next = options.active - 1;
- this._activate( next >= 0 ? next : 0 );
+ } else {
+ this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
+ }
// was active, active tab still exists
} else {
// make sure active index is correct