Skip to content

Commit aa63c4b

Browse files
committed
button: handle space "click"
1 parent 967454c commit aa63c4b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ui/jquery.ui.button.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ $.widget( "ui.button", {
137137
.bind( "keyup.button", function() {
138138
$( this ).removeClass( "ui-state-active" );
139139
});
140+
if (this.buttonElement.is("a")) {
141+
this.buttonElement.keyup(function(event) {
142+
if (event.keyCode == $.ui.keyCode.SPACE) {
143+
// TODO pass through original event correctly (just as 2nd argument doesn't work)
144+
$(this).trigger("click");
145+
}
146+
})
147+
}
140148
}
141149

142150
this._resetButton();

0 commit comments

Comments
 (0)