Skip to content
Permalink
Browse files
Button: add blur event to buttons. Fixes #8559 - Button: Button doesn…
…'t remove active state when using keyboard.
  • Loading branch information
mikesherov committed Nov 22, 2012
1 parent c348f28 commit f13b5df
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
@@ -13,4 +13,14 @@ test("buttonset works with single-quote named elements (#7505)", function() {
}).click();
});

test( "when button loses focus, ensure active state is removed (#8559)", function() {
expect( 1 );

$("#button").button().keypress( function() {
$("#button").blur( function() {
ok( !$("#button").is(".ui-state-active"), "button loses active state appropriately" );
}).blur();
}).focus().simulate( "keydown", { keyCode: $.ui.keyCode.ENTER } ).simulate( "keypress", { keyCode: $.ui.keyCode.ENTER } );
});

})(jQuery);
@@ -193,7 +193,7 @@ $.widget( "ui.button", {
$( this ).addClass( "ui-state-active" );
}
})
.bind( "keyup" + this.eventNamespace, function() {
.bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() {
$( this ).removeClass( "ui-state-active" );
});

0 comments on commit f13b5df

Please sign in to comment.