aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorRichard Worth <rdworth@gmail.com>2010-03-15 14:00:53 +0000
committerRichard Worth <rdworth@gmail.com>2010-03-15 14:00:53 +0000
commita842215fdb709378e93411cecf253777d0fb721a (patch)
tree601dd8007f5e539f6f4b2e3b101f7f479eb27fa1 /ui
parenta0ac772745c712f1d534a1881ab6a8eb700ede45 (diff)
downloadjquery-ui-a842215fdb709378e93411cecf253777d0fb721a.tar.gz
jquery-ui-a842215fdb709378e93411cecf253777d0fb721a.zip
button: fixed #5328 - button disabled only visually when disabled option set, still functional
Diffstat (limited to 'ui')
-rw-r--r--ui/jquery.ui.button.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js
index 5e5a640ad..ec7008dd5 100644
--- a/ui/jquery.ui.button.js
+++ b/ui/jquery.ui.button.js
@@ -69,6 +69,10 @@ $.widget( "ui.button", {
options.label = this.buttonElement.html();
}
+ if ( this.element.is(":disabled") ) {
+ options.disabled = true;
+ }
+
this.buttonElement
.addClass( baseClasses )
.attr( "role", "button" )
@@ -104,7 +108,7 @@ $.widget( "ui.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 );
@@ -112,7 +116,7 @@ $.widget( "ui.button", {
} 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 );
@@ -130,7 +134,7 @@ $.widget( "ui.button", {
this.buttonElement
.bind( "mousedown.button", function() {
if ( options.disabled ) {
- return;
+ return false;
}
$( this ).addClass( "ui-state-active" );
lastActive = this;
@@ -140,13 +144,13 @@ $.widget( "ui.button", {
})
.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" );
@@ -225,6 +229,9 @@ $.widget( "ui.button", {
_setOption: function( key, value ) {
$.Widget.prototype._setOption.apply( this, arguments );
+ if ( key === "disabled" ) {
+ this.element.attr("disabled", value);
+ }
this._resetButton();
},