aboutsummaryrefslogtreecommitdiffstats
path: root/tests/visual
diff options
context:
space:
mode:
authorjzaefferer <joern.zaefferer@gmail.com>2011-02-28 22:53:06 +0100
committerjzaefferer <joern.zaefferer@gmail.com>2011-02-28 22:53:06 +0100
commit58b730f7c7a2fa848eeab12c5b26736a102ed1a4 (patch)
tree872c5a5629957b6ce05435fce0013b6085c928eb /tests/visual
parentf76e7498e71fb41d54daab7e028cff48809528d4 (diff)
downloadjquery-ui-58b730f7c7a2fa848eeab12c5b26736a102ed1a4.tar.gz
jquery-ui-58b730f7c7a2fa848eeab12c5b26736a102ed1a4.zip
Menubar: Close menu on input click when already open
Diffstat (limited to 'tests/visual')
-rw-r--r--tests/visual/menu/menubar.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/visual/menu/menubar.js b/tests/visual/menu/menubar.js
index 57d9ee5de..afddd76a6 100644
--- a/tests/visual/menu/menubar.js
+++ b/tests/visual/menu/menubar.js
@@ -49,13 +49,16 @@ $.widget("ui.menubar", {
var input = $(this),
menu = input.next("ul");
- input
- .bind("click focus mouseenter", function(event) {
+ input.bind("click focus mouseenter", function(event) {
+ event.preventDefault();
+ event.stopPropagation();
+ if (menu.is(":visible") && self.active && self.active[0] == menu[0]) {
+ self._close();
+ return;
+ }
if (menu.length && (!/^mouse/.test(event.type) || self.active && self.active.is(":visible") )) {
self._open(event, menu);
}
- event.preventDefault();
- event.stopPropagation();
})
.addClass("ui-button ui-widget ui-button-text-only ui-menubar-link")
.wrapInner("<span class='ui-button-text'></span>");