diff options
author | jzaefferer <joern.zaefferer@gmail.com> | 2010-03-24 18:01:43 -0400 |
---|---|---|
committer | jzaefferer <joern.zaefferer@gmail.com> | 2010-03-24 18:01:43 -0400 |
commit | 27c5debb599b40dc9bd4d0c2267fa2afd48cbfc2 (patch) | |
tree | a7fdba8de03ee841838f73503e71edfdbf4f862e /tests/visual/menu/drilldown.html | |
parent | b90438d90e1737b33ee735281ab8bd408c3e4468 (diff) | |
download | jquery-ui-27c5debb599b40dc9bd4d0c2267fa2afd48cbfc2.tar.gz jquery-ui-27c5debb599b40dc9bd4d0c2267fa2afd48cbfc2.zip |
Improved drilldown keyboard handling
Diffstat (limited to 'tests/visual/menu/drilldown.html')
-rw-r--r-- | tests/visual/menu/drilldown.html | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/visual/menu/drilldown.html b/tests/visual/menu/drilldown.html index 78b8cf9f2..a97d8322c 100644 --- a/tests/visual/menu/drilldown.html +++ b/tests/visual/menu/drilldown.html @@ -14,7 +14,7 @@ $.widget("ui.drilldown", { _init: function() { var self = this; - this.active = this.element; + this.active = this.element.find(">ul").attr("tabindex", 0); // hide submenus and create indicator icons this.element.find("ul").hide().prev("a").prepend('<span class="ui-icon ui-icon-carat-1-e"></span>').end().filter(":first").show(); @@ -84,17 +84,21 @@ parent.parent().removeData("submenu"); submenu = submenu.data("submenu"); }; + }, + + widget: function() { + return this.element.find(">ul"); } }); - var nestedmenu = $("#drilldown").drilldown({ + var drilldown = $("#drilldown").drilldown({ selected: function(event, ui) { $("#log").append("<div>Selected " + ui.item.text() + "</div>"); } }); - $().keydown(function(event) { - var menu = nestedmenu.data("drilldown").active.data("menu"); + drilldown.drilldown("widget").keydown(function(event) { + var menu = drilldown.data("drilldown").active.data("menu"); if (menu.widget().is(":hidden")) return; event.stopPropagation(); @@ -109,10 +113,10 @@ menu.previous(); break; case $.ui.keyCode.LEFT: - nestedmenu.nestedmenu("up"); + drilldown.drilldown("up"); break; case $.ui.keyCode.RIGHT: - nestedmenu.nestedmenu("down"); + drilldown.drilldown("down"); break; case $.ui.keyCode.DOWN: menu.next(); @@ -121,11 +125,11 @@ case $.ui.keyCode.ENTER: case $.ui.keyCode.TAB: menu.select(); - nestedmenu.nestedmenu("hide"); + drilldown.drilldown("hide"); event.preventDefault(); break; case $.ui.keyCode.ESCAPE: - nestedmenu.nestedmenu("hide"); + drilldown.drilldown("hide"); break; default: clearTimeout(menu.filterTimer); |