From aa63c4b9594aed63ef43e5aa0ecad6fecd8f8d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Zaefferer?= Date: Fri, 22 Jan 2010 22:52:31 +0000 Subject: [PATCH] button: handle space "click" --- ui/jquery.ui.button.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index 8e016cb39..d69e912ff 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -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();