mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Button: add blur event to buttons. Fixes #8559 - Button: Button doesn't remove active state when using keyboard.
This commit is contained in:
parent
c348f2890c
commit
f13b5dfa7f
@ -13,4 +13,14 @@ test("buttonset works with single-quote named elements (#7505)", function() {
|
|||||||
}).click();
|
}).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);
|
})(jQuery);
|
||||||
|
2
ui/jquery.ui.button.js
vendored
2
ui/jquery.ui.button.js
vendored
@ -193,7 +193,7 @@ $.widget( "ui.button", {
|
|||||||
$( this ).addClass( "ui-state-active" );
|
$( this ).addClass( "ui-state-active" );
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.bind( "keyup" + this.eventNamespace, function() {
|
.bind( "keyup" + this.eventNamespace + " blur" + this.eventNamespace, function() {
|
||||||
$( this ).removeClass( "ui-state-active" );
|
$( this ).removeClass( "ui-state-active" );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user