diff options
author | jzaefferer <joern.zaefferer@gmail.com> | 2011-02-24 11:13:37 +0100 |
---|---|---|
committer | jzaefferer <joern.zaefferer@gmail.com> | 2011-02-24 11:14:20 +0100 |
commit | 5c687be331d3110ece3b2417c021485950f87ff9 (patch) | |
tree | 97ad1f2ec340b827b93a2b1007e603042291aebc | |
parent | 6bd95efe5e1a6f013a1efee73f9ce468013c2c35 (diff) | |
download | jquery-ui-5c687be331d3110ece3b2417c021485950f87ff9.tar.gz jquery-ui-5c687be331d3110ece3b2417c021485950f87ff9.zip |
Menu: Refactoring flyout menu in prepartion for merging into menu
-rw-r--r-- | tests/visual/menu/flyoutmenu.js | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/tests/visual/menu/flyoutmenu.js b/tests/visual/menu/flyoutmenu.js index 1e968dd61..0564120a2 100644 --- a/tests/visual/menu/flyoutmenu.js +++ b/tests/visual/menu/flyoutmenu.js @@ -16,7 +16,6 @@ $.widget("ui.flyoutmenu", { _create: function() { var self = this; - this.active = this.element; this.activeItem = this.element.children("li").first(); // hide submenus and create indicator icons this.element.find("ul").addClass("ui-menu-flyout").hide().prev("a").prepend('<span class="ui-icon ui-icon-carat-1-e"></span>'); @@ -26,12 +25,13 @@ $.widget("ui.flyoutmenu", { self._select(event); }, focus: function(event, ui) { - self.active = ui.item.parent(); self.activeItem = ui.item; + ui.item.parent().focus(); ui.item.parent().find("ul").hide(); var nested = $(">ul", ui.item); if (nested.length && event.originalEvent && /^mouse/.test(event.originalEvent.type)) { self._open(nested); + nested.focus(); } } }).keydown(function(event) { @@ -60,7 +60,7 @@ $.widget("ui.flyoutmenu", { _open: function(submenu) { // TODO restrict to widget //only one menu can have items open at a time. - $(document).find(".ui-menu-flyout").not(submenu.parents()).hide(); + $(document).find(".ui-menu-flyout").not(submenu.parents()).hide().data("menu").blur(); var position = $.extend({}, { of: this.activeItem @@ -93,16 +93,12 @@ $.widget("ui.flyoutmenu", { } }, activate: function(event, item) { - if (item) { - item.parent().data("menu").widget().show(); - item.parent().data("menu").focus(event, item); - } + var parent = item.parent(); + parent.data("menu").focus(event, item); this.activeItem = item; - this.active = item.parent("ul") - this.active.focus(); + parent.focus(); }, show: function() { - this.active = this.element; this.element.show(); }, hide: function() { |