From 2ed1a1261754dbef9f0f37af1b8bdbc6b24011de Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 26 Sep 2022 13:36:10 +0200 Subject: [PATCH] Fix topmenu dropdowns click handler --- api/js/jsapi/egw_timer.js | 18 ++++++++++++++++-- pixelegg/js/slider.js | 11 +++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/api/js/jsapi/egw_timer.js b/api/js/jsapi/egw_timer.js index 57e745227b..46e5315fe4 100644 --- a/api/js/jsapi/egw_timer.js +++ b/api/js/jsapi/egw_timer.js @@ -158,11 +158,25 @@ egw.extend('timer', egw.MODULE_GLOBAL, function() if (select.value) timerAction(select.value); select.value = ''; }); + + select.addEventListener('sl-hide', (e) => { + if (e.currentTarget.nodeName === 'ET2-SELECT') + { + e.stopImmediatePropagation(); + } + }); // bind click handler timer_container.addEventListener('click', (ev) => { - select.dropdown.open = !select.dropdown.open ? true : false; - ev.stopPropagation(); + ev.stopImmediatePropagation(); + if (select.dropdown.open) + { + select.dropdown.hide(); + } + else + { + select.dropdown.show(); + } }); // need to load timesheet translations for app-names this.langRequire(window, [{app: 'timesheet', lang: this.preference('lang')}], () => diff --git a/pixelegg/js/slider.js b/pixelegg/js/slider.js index 7b65075b67..d477cab7ba 100644 --- a/pixelegg/js/slider.js +++ b/pixelegg/js/slider.js @@ -18,8 +18,15 @@ egw_ready.then(function() click: function(ev){ // do NOT react on bubbeling events from contained selectbox var select = document.getElementById('quick_add_selectbox'); - select.dropdown.open = !select.dropdown.open ? true : false; - ev.stopPropagation(); + ev.stopImmediatePropagation(); + if (select.dropdown.open) + { + select.dropdown.hide(); + } + else + { + select.dropdown.show(); + } } });