From f89fafb7813ac56bac5e26091322423b140ad021 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 13 Apr 2018 10:21:34 +0200 Subject: [PATCH] Elastic: Handle more corner cases of hide-menu event --- skins/elastic/ui.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/skins/elastic/ui.js b/skins/elastic/ui.js index ce3d9c384..d9c30569a 100644 --- a/skins/elastic/ui.js +++ b/skins/elastic/ui.js @@ -2136,9 +2136,14 @@ function rcube_elastic_ui() else { target = $('#' + name).data('button'); - // catch cases as 'forwardmenu' where menu suffix has no hyphen - if (!target && name.match(/(?!-)menu$/)) { - target = $('#' + name.substr(0, name.length - 4) + '-menu').data('button'); + if (!target) { + // catch cases as 'forwardmenu' where menu suffix has no hyphen + // or try with -menu suffix if it's not in the menu name already + if (name.match(/(?!-)menu$/)) { + name = name.substr(0, name.length - 4); + } + + target = $('#' + name + '-menu').data('button'); } }