Permalink
Browse files

Button: fix #5295 button doesn't remove hover state if they are disabled

  • Loading branch information...
1 parent f0007ec commit cab36278a652fab488018825b6080ab643cfd981 @cgack committed Jan 1, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 ui/jquery.ui.button.js
View
7 ui/jquery.ui.button.js
@@ -67,7 +67,7 @@ $.widget( "ui.button", {
var self = this,
options = this.options,
toggleButton = this.type === "checkbox" || this.type === "radio",
- hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ),
+ activeClass = !toggleButton ? "ui-state-active" : "",
focusClass = "ui-state-focus";
if ( options.label === null ) {
@@ -78,14 +78,15 @@ $.widget( "ui.button", {
options.disabled = true;
}
+ this._hoverable( this.buttonElement );
+
this.buttonElement
.addClass( baseClasses )
.attr( "role", "button" )
.bind( "mouseenter.button", function() {
if ( options.disabled ) {
return;
}
- $( this ).addClass( "ui-state-hover" );
if ( this === lastActive ) {
$( this ).addClass( "ui-state-active" );
}
@@ -94,7 +95,7 @@ $.widget( "ui.button", {
if ( options.disabled ) {
return;
}
- $( this ).removeClass( hoverClass );
+ $( this ).removeClass( activeClass );
})
.bind( "click.button", function( event ) {
if ( options.disabled ) {

0 comments on commit cab3627

Please sign in to comment.