Skip to content

Commit 967454c

Browse files
committed
button: add ui-state-active on keydown, further improving keyboard navigation - doesn't yet work properly for anchors and radio/checkbox buttons
1 parent cc77201 commit 967454c

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
@@ -128,6 +128,14 @@ $.widget( "ui.button", {
128128
return;
129129
}
130130
$( this ).removeClass( "ui-state-active" );
131+
})
132+
.bind( "keydown.button", function(event) {
133+
if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {
134+
$( this ).addClass( "ui-state-active" );
135+
}
136+
})
137+
.bind( "keyup.button", function() {
138+
$( this ).removeClass( "ui-state-active" );
131139
});
132140
}
133141

0 commit comments

Comments
 (0)