From a881e460062d8487d439011b5ddab2b70485fbf5 Mon Sep 17 00:00:00 2001 From: moisseev Date: Wed, 23 Jun 2021 11:45:13 +0300 Subject: [PATCH] [Minor] Dismiss popover by clicking outside --- interface/js/app/rspamd.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index 171812a0c..711ec1971 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -468,6 +468,19 @@ function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_ custom_locale = $(localeTextbox).val(); validateLocale(true); }); + + // Dismiss Bootstrap popover by clicking outside + $("body").on("click", function (e) { + $(".popover").each(function () { + if ( + // Popover's descendant + $(this).has(e.target).length || + // Button (or icon within a button) that triggers the popover. + $(e.target).closest("button").attr("aria-describedby") === this.id + ) return; + $(this).popover("hide"); + }); + }); }()); $("#selData").change(function () { -- 2.39.5