From 0ddf677e40a7feaaeefcc44f2a4910923f1bc258 Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Thu, 24 Feb 2011 15:51:51 +0100 Subject: [PATCH] Menu: Integrated flyoutmenu into menu, and moved flyoutmenu.html testmenu into contextmenu.html --- tests/visual/menu/contextmenu.html | 74 +++++++++++++++-- tests/visual/menu/flyoutmenu.html | 127 ----------------------------- tests/visual/menu/flyoutmenu.js | 110 ------------------------- tests/visual/menu/menu.html | 12 ++- themes/base/jquery.ui.menu.css | 2 + ui/jquery.ui.menu.js | 103 +++++++++++++++++++---- 6 files changed, 169 insertions(+), 259 deletions(-) delete mode 100644 tests/visual/menu/flyoutmenu.html delete mode 100644 tests/visual/menu/flyoutmenu.js diff --git a/tests/visual/menu/contextmenu.html b/tests/visual/menu/contextmenu.html index dae366158..c91b4ea1b 100644 --- a/tests/visual/menu/contextmenu.html +++ b/tests/visual/menu/contextmenu.html @@ -20,15 +20,28 @@ top: 10 }).appendTo(document.body).themeswitcher(); + // TODO close other menus when opening a new one $("button").each(function() { $(this).next().menu({ + /* top-alignment + position: function(item) { + return { + my: "left top", + at: "right top", + of: item.parent() + } + }, + */ select: function(event, ui) { $(this).hide().prev().focus(); $("#log").append("
Selected " + ui.item.text() + "
"); } }).hide(); + + // equal height + //menu.find("ul").height(menu.height()); }).click(function(event) { - // TODO required to prevent the click handler below from handling this event + // required to prevent the click handler below from handling this event event.stopPropagation(); var menu = $("#menu" + this.id).menu("blur").show().position({ my: "left top", @@ -36,7 +49,7 @@ of: event.pageX > 0 ? event : this }).focus(); $(document).one("click", function() { - menu.hide(); + menu.menu("closeAll").menu("widget").hide(); }) }).next().keydown(function(event) { var menu = $(this).data("menu"); @@ -45,10 +58,14 @@ event.stopPropagation(); switch (event.keyCode) { case $.ui.keyCode.TAB: + menu.closeAll(); menu.widget().hide(); + $(this).prev().focus() break; case $.ui.keyCode.ESCAPE: + menu.closeAll(); menu.widget().hide(); + $(this).prev().focus() break; default: @@ -59,7 +76,7 @@ @@ -76,13 +93,60 @@
  • Zurich
  • + + + +
    Log:
    - -