Fixed persistent menu bar after clicking on an entry

canary
WolverinDEV 2019-12-03 16:59:04 +01:00
parent eff220de5d
commit b82267d67f
1 changed files with 8 additions and 1 deletions

View File

@ -85,9 +85,12 @@ namespace top_menu {
if(this._callback_click && !disabled) { if(this._callback_click && !disabled) {
this._callback_click(); this._callback_click();
} }
event.preventDefault(); event.preventDefault();
if(disabled) if(disabled)
event.stopPropagation(); event.stopPropagation();
else
HTMLMenuBarDriver.instance().close();
}); });
this._submenu_tag = $.spawn("div").addClass("sub-menu"); this._submenu_tag = $.spawn("div").addClass("sub-menu");
@ -183,7 +186,7 @@ namespace top_menu {
item._label_tag.on('click', enable_event => { item._label_tag.on('click', enable_event => {
enable_event.preventDefault(); enable_event.preventDefault();
this.html_tag.find(".active").removeClass("active"); this.close();
item.html_tag.addClass("active"); item.html_tag.addClass("active");
setTimeout(() => { setTimeout(() => {
@ -198,6 +201,10 @@ namespace top_menu {
return item; return item;
} }
close() {
this.html_tag.find(".active").removeClass("active");
}
delete_item(item: MenuItem) { delete_item(item: MenuItem) {
return undefined; return undefined;
} }