options.label = this.buttonElement.html();
}
+ if ( this.element.is(":disabled") ) {
+ options.disabled = true;
+ }
+
this.buttonElement
.addClass( baseClasses )
.attr( "role", "button" )
if ( this.type === "checkbox" ) {
this.buttonElement.bind( "click.button", function() {
if ( options.disabled ) {
- return;
+ return false;
}
$( this ).toggleClass( "ui-state-active" );
self.buttonElement.attr( "aria-pressed", self.element[0].checked );
} else if ( this.type === "radio" ) {
this.buttonElement.bind( "click.button", function() {
if ( options.disabled ) {
- return;
+ return false;
}
$( this ).addClass( "ui-state-active" );
self.buttonElement.attr( "aria-pressed", true );
this.buttonElement
.bind( "mousedown.button", function() {
if ( options.disabled ) {
- return;
+ return false;
}
$( this ).addClass( "ui-state-active" );
lastActive = this;
})
.bind( "mouseup.button", function() {
if ( options.disabled ) {
- return;
+ return false;
}
$( this ).removeClass( "ui-state-active" );
})
.bind( "keydown.button", function(event) {
if ( options.disabled ) {
- return;
+ return false;
}
if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {
$( this ).addClass( "ui-state-active" );
_setOption: function( key, value ) {
$.Widget.prototype._setOption.apply( this, arguments );
+ if ( key === "disabled" ) {
+ this.element.attr("disabled", value);
+ }
this._resetButton();
},