button: handle space "click"

This commit is contained in:
Jörn Zaefferer 2010-01-22 22:52:31 +00:00
parent 967454c434
commit aa63c4b959

View File

@ -137,6 +137,14 @@ $.widget( "ui.button", {
.bind( "keyup.button", function() {
$( this ).removeClass( "ui-state-active" );
});
if (this.buttonElement.is("a")) {
this.buttonElement.keyup(function(event) {
if (event.keyCode == $.ui.keyCode.SPACE) {
// TODO pass through original event correctly (just as 2nd argument doesn't work)
$(this).trigger("click");
}
})
}
}
this._resetButton();