From cabb080d91894f60002f79764cd46d512016e2fd Mon Sep 17 00:00:00 2001 From: MatthieuLP Date: Mon, 17 Jul 2023 15:41:30 +0200 Subject: [PATCH] related to #1931 Clicking outside a filter closes the openned filter --- themes/default/js/mcs.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/themes/default/js/mcs.js b/themes/default/js/mcs.js index a8bcfe66c..e04809fa2 100644 --- a/themes/default/js/mcs.js +++ b/themes/default/js/mcs.js @@ -25,6 +25,19 @@ $(document).ready(function () { }); }); + $(document).on('click', function (e) { + $(".filter-form").each(function () { + if ($(this).parent().hasClass("show-filter-dropdown") && + $(this).parent().has(e.target).length === 0 && + !$(this).parent().is(e.target)) { + $(this).parent().trigger('click'); + if ($(".filter").has(e.target).length !== 0) { + $(e.target).trigger('click'); + } + } + }); + }) + global_params.search_id = search_id; if (!global_params.fields) { @@ -334,6 +347,7 @@ $(document).ready(function () { } $(".filter-tag-form").toggle(0, function () { if ($(this).is(':visible')) { + $(".show-filter-dropdown").removeClass('show-filter-dropdown'); $(".filter-tag").addClass("show-filter-dropdown"); } else { $(".filter-tag").removeClass("show-filter-dropdown");