From b82267d67f80a377664b666f4a00c673020e523c Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Tue, 3 Dec 2019 16:59:04 +0100 Subject: [PATCH] Fixed persistent menu bar after clicking on an entry --- shared/js/ui/frames/MenuBar.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/shared/js/ui/frames/MenuBar.ts b/shared/js/ui/frames/MenuBar.ts index fc4cf636..96d39e90 100644 --- a/shared/js/ui/frames/MenuBar.ts +++ b/shared/js/ui/frames/MenuBar.ts @@ -85,9 +85,12 @@ namespace top_menu { if(this._callback_click && !disabled) { this._callback_click(); } + event.preventDefault(); if(disabled) event.stopPropagation(); + else + HTMLMenuBarDriver.instance().close(); }); this._submenu_tag = $.spawn("div").addClass("sub-menu"); @@ -183,7 +186,7 @@ namespace top_menu { item._label_tag.on('click', enable_event => { enable_event.preventDefault(); - this.html_tag.find(".active").removeClass("active"); + this.close(); item.html_tag.addClass("active"); setTimeout(() => { @@ -198,6 +201,10 @@ namespace top_menu { return item; } + close() { + this.html_tag.find(".active").removeClass("active"); + } + delete_item(item: MenuItem) { return undefined; }