]> source.dussan.org Git - jquery-ui.git/commitdiff
Popup: Improve key handling
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Fri, 6 May 2011 17:49:50 +0000 (19:49 +0200)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Fri, 6 May 2011 22:43:07 +0000 (00:43 +0200)
tests/visual/menu/popup.js

index 5f7b41538cdfdf350c5437919221de63c3e1f284..97f12c053bbe378dbe8a31e2f14177e546059ff9 100644 (file)
@@ -38,13 +38,13 @@ $.widget( "ui.popup", {
 
                this._bind(this.options.trigger, {
                        keydown: function( event ) {
-                               // prevent space-to-open to scroll the page
-                               // TODO do this only for a:ui-button?
-                               if (event.keyCode == $.ui.keyCode.SPACE) {
+                               // prevent space-to-open to scroll the page, only hapens for anchor ui.button
+                               if ($( event.currentTarget ).is( "a:ui-button" ) && event.keyCode == $.ui.keyCode.SPACE) {
                                        event.preventDefault()
                                }
-                               // TODO handle keydown to open popup?
-                               //if (event.keyCode == $.ui.keyCode.SPACE) { .. }
+                               // TODO handle keydown to open popup? only when not handled by ui.button
+                               //if (event.keyCode == $.ui.keyCode.SPACE) {
+                               //}
                        },
                        click: function( event ) {
                                event.preventDefault();