aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2010-01-22 22:46:32 +0000
committerJörn Zaefferer <joern.zaefferer@gmail.com>2010-01-22 22:46:32 +0000
commit967454c43443e19b270f13be3840c451edecdfbc (patch)
tree71639970c55d5f09c9bf70008b9fa91c2b6cfde3
parentcc77201c8e55a4ffc4d4ff5287cfdc14bce7a3e1 (diff)
downloadjquery-ui-967454c43443e19b270f13be3840c451edecdfbc.tar.gz
jquery-ui-967454c43443e19b270f13be3840c451edecdfbc.zip
button: add ui-state-active on keydown, further improving keyboard navigation - doesn't yet work properly for anchors and radio/checkbox buttons
-rw-r--r--ui/jquery.ui.button.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js
index b2ae0f9df..8e016cb39 100644
--- a/ui/jquery.ui.button.js
+++ b/ui/jquery.ui.button.js
@@ -128,6 +128,14 @@ $.widget( "ui.button", {
return;
}
$( this ).removeClass( "ui-state-active" );
+ })
+ .bind( "keydown.button", function(event) {
+ if ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {
+ $( this ).addClass( "ui-state-active" );
+ }
+ })
+ .bind( "keyup.button", function() {
+ $( this ).removeClass( "ui-state-active" );
});
}