diff --git a/src/client/app/widgets/buttons/menu.js b/src/client/app/widgets/buttons/menu.js index 8bb7d291..6410a2a6 100644 --- a/src/client/app/widgets/buttons/menu.js +++ b/src/client/app/widgets/buttons/menu.js @@ -122,6 +122,11 @@ class Menu extends Widget { } else { this.menu.classList.add('norelease') + this.toggleCloseHandler = (e)=>{ + if (!this.opened || this.menu.contains(e.target)) return + this.close() + } + document.addEventListener('fast-click', this.toggleCloseHandler) } @@ -310,6 +315,15 @@ class Menu extends Widget { } + onRemove() { + + if (this.getProp('toggle')) { + document.removeEventListener('fast-click', this.toggleCloseHandler) + } + super.onRemove() + + } + } Menu.dynamicProps = Menu.prototype.constructor.dynamicProps.concat(