From 967454c43443e19b270f13be3840c451edecdfbc Mon Sep 17 00:00:00 2001 From: Jörn Zaefferer Date: Fri, 22 Jan 2010 22:46:32 +0000 Subject: button: add ui-state-active on keydown, further improving keyboard navigation - doesn't yet work properly for anchors and radio/checkbox buttons --- ui/jquery.ui.button.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ui/jquery.ui.button.js') 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" ); }); } -- cgit v1.2.3