From 3625b7bc4684ba50dc69c4d6789099895a65f07b Mon Sep 17 00:00:00 2001 From: Laura_Escamilla Date: Fri, 29 Aug 2025 14:16:04 +0000 Subject: [PATCH] Bug 40726: Prevent closing the user menu when clicking off of the dropdown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To test: 1. In the staff interface click on the user menu (top right corner where it has the user and library branch). 2. Click the gear icon. 3. Try to click a dropdown but miss it and click outside of it (still in the grey box area). 4. View the menu collapsing. 5. Apply the patch & restart all. Refresh your page. 6. Retry steps 1-3. Notice now that when you click within the grey box area around the drop down the user menu no longer closes. However, if you click outside of the dropdown menu (anywhere else on the interface screen) the user menu closes. 7. Sign off — have an amazing day! :D --- koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index ed6f0b35f7..687b2a7218 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -443,6 +443,19 @@ $(document).ready(function () { } }); + (function () { + const trigger = document.getElementById("logged-in-menu"); + if (trigger) { + bootstrap.Dropdown.getOrCreateInstance(trigger, { + autoClose: "outside", + }); + } + })(); + + $("#setlibrary_panel").on("click", function (e) { + e.stopPropagation(); + }); + $("#logged-in-dropdown").on("hidden.bs.dropdown", function () { $("#setlibrary_panel") .removeClass("setlibrary_panel_open") -- 2.39.5