aboutsummaryrefslogtreecommitdiffstats
path: root/tests/visual/menu/flyoutmenu.js
diff options
context:
space:
mode:
authorjzaefferer <joern.zaefferer@gmail.com>2011-02-22 15:14:12 +0100
committerjzaefferer <joern.zaefferer@gmail.com>2011-02-22 15:14:12 +0100
commitf8091f761cf3705087efc90cc09f74e5f83744bb (patch)
tree93afce62a9ac489156e17988084ee3148613530d /tests/visual/menu/flyoutmenu.js
parent68c13cd6a624b145ccf9a585baaea0aa36eff60c (diff)
downloadjquery-ui-f8091f761cf3705087efc90cc09f74e5f83744bb.tar.gz
jquery-ui-f8091f761cf3705087efc90cc09f74e5f83744bb.zip
Menu: Overhauled menubar, again starting with Michael Lang's fork. Added
working keyboard navigation, including nested menus. Still need to properly style the menu buttons, e.g. highlight the button of the currently open menu.
Diffstat (limited to 'tests/visual/menu/flyoutmenu.js')
-rw-r--r--tests/visual/menu/flyoutmenu.js22
1 files changed, 8 insertions, 14 deletions
diff --git a/tests/visual/menu/flyoutmenu.js b/tests/visual/menu/flyoutmenu.js
index 8534c9462..54ee8bb67 100644
--- a/tests/visual/menu/flyoutmenu.js
+++ b/tests/visual/menu/flyoutmenu.js
@@ -34,14 +34,17 @@ $.widget("ui.flyoutmenu", {
}).keydown(function(event) {
if (self.element.is(":hidden"))
return;
- event.stopPropagation();
switch (event.keyCode) {
case $.ui.keyCode.LEFT:
- self.left(event);
+ if (self.left(event)) {
+ event.stopImmediatePropagation();
+ }
event.preventDefault();
break;
case $.ui.keyCode.RIGHT:
- self.right(event);
+ if (self.right(event)) {
+ event.stopImmediatePropagation();
+ }
event.preventDefault();
break;
case $.ui.keyCode.ESCAPE:
@@ -98,22 +101,18 @@ $.widget("ui.flyoutmenu", {
at: "right top",
of: this.activeItem
});
- $(document).one("click", function() {
- //clicking outside menu flyouts should close all flyouts
- //$(document).find(".ui-menu-flyout").hide();
- })
},
_select: function(event) {
event.stopPropagation();
// TODO make _select cancelable?
this._trigger( "select", event, { item: this.activeItem } );
- //this.activate(event, this.element.children("li").first());
this.hide();
},
left: function(event) {
var newItem = this.activeItem.parents("li").first();
if (newItem.length) {
this.activate(event, newItem);
+ return true;
}
},
right: function(event) {
@@ -121,6 +120,7 @@ $.widget("ui.flyoutmenu", {
if (newItem.length) {
this._open(newItem.parent());
this.activate(event, newItem);
+ return true;
}
},
activate: function(event, item) {
@@ -135,12 +135,6 @@ $.widget("ui.flyoutmenu", {
show: function() {
this.active = this.element;
this.element.show();
- if (this.element.hasClass("ui-menu-flyout")) {
- $(document).one("click", function() {
- //clicking outside menu flyouts should close all flyouts
- //$(document).find(".ui-menu-flyout").hide();
- })
- }
},
hide: function() {
this.activeItem = this.element.children("li").first();