Skip to content

Commit 80f85e0

Browse files
committed
Tabs: Adjust handling of disabled option, using _setOptionDisabled
Tabs support multiple values to disable individual tabs. Only add the ui-tabs-disabled class when all tabs are disabled. Ref #9151
1 parent 19c7852 commit 80f85e0

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

ui/widgets/tabs.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,6 @@ $.widget( "ui.tabs", {
291291
return;
292292
}
293293

294-
if ( key === "disabled" ) {
295-
296-
// don't use the widget factory's disabled handling
297-
this._setupDisabled( value );
298-
return;
299-
}
300-
301294
this._super( key, value );
302295

303296
if ( key === "collapsible" ) {
@@ -363,7 +356,7 @@ $.widget( "ui.tabs", {
363356
},
364357

365358
_refresh: function() {
366-
this._setupDisabled( this.options.disabled );
359+
this._setOptionDisabled( this.options.disabled );
367360
this._setupEvents( this.options.event );
368361
this._setupHeightStyle( this.options.heightStyle );
369362

@@ -507,7 +500,7 @@ $.widget( "ui.tabs", {
507500
.data( "ui-tabs-destroy", true );
508501
},
509502

510-
_setupDisabled: function( disabled ) {
503+
_setOptionDisabled: function( disabled ) {
511504
var currentItem, li, i;
512505

513506
if ( $.isArray( disabled ) ) {
@@ -531,6 +524,9 @@ $.widget( "ui.tabs", {
531524
}
532525

533526
this.options.disabled = disabled;
527+
528+
this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null,
529+
disabled === true );
534530
},
535531

536532
_setupEvents: function( event ) {
@@ -804,7 +800,7 @@ $.widget( "ui.tabs", {
804800
} );
805801
}
806802
}
807-
this._setupDisabled( disabled );
803+
this._setOptionDisabled( disabled );
808804
},
809805

810806
disable: function( index ) {
@@ -826,7 +822,7 @@ $.widget( "ui.tabs", {
826822
disabled = [ index ];
827823
}
828824
}
829-
this._setupDisabled( disabled );
825+
this._setOptionDisabled( disabled );
830826
},
831827

832828
load: function( index, event ) {

0 commit comments

Comments
 (0)