From 1e143244e2ab6350eaa7255e8b53a6f1290cc415 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 14 Jun 2022 17:10:18 +0200 Subject: [PATCH] navigation.js: Only activate visible items or config menu items --- public/js/icinga/behavior/navigation.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/public/js/icinga/behavior/navigation.js b/public/js/icinga/behavior/navigation.js index a8c507b33..3befe4bd3 100644 --- a/public/js/icinga/behavior/navigation.js +++ b/public/js/icinga/behavior/navigation.js @@ -221,8 +221,19 @@ }; Navigation.prototype.setActiveAndSelected = function ($el) { - this.setActive($el); - this.setSelected($el); + if ($el.length > 1) { + $el.each(el => { + if (! this.active) { + this.setActiveAndSelected($(el)); + } + }); + } else if ($el.length) { + if ($el[0].offsetWidth || $el[0].offsetHeight || $el.closest('.config-menu').length) { + // It's either a visible menu item or a config menu item + this.setActive($el); + this.setSelected($el); + } + } }; /**