From 023e7c5594cafc33a2e96b1ec4872d51346203e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Wed, 3 Jan 2018 05:13:56 +0100 Subject: [PATCH 1/2] Fix popover menu not closing in user settings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A popover menu is displayed when its element has the "open" CSS class. That class is added when clicking on the menu toggle, but it was removed only when clicking again on the toggle, so the popover menu in user settings could be closed only by clicking again on the menu toggle. Now the "open" CSS class is removed too when clicking on the body, either directly or through event propagation. Signed-off-by: Daniel Calviño Sánchez --- settings/js/users/users.js | 1 + 1 file changed, 1 insertion(+) diff --git a/settings/js/users/users.js b/settings/js/users/users.js index af41790a7c472..7b98af985ac0e 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -972,6 +972,7 @@ $(document).ready(function () { $(document.body).click(function () { $('#userlist tr.active').removeClass('active'); + $('#userlist .popovermenu.open').removeClass('open'); }); $userListBody.on('click', '.action-togglestate', function (event) { From 160e1e1882cb0bf40fb14f88f493d39e85f7dbc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Wed, 3 Jan 2018 06:24:51 +0100 Subject: [PATCH 2/2] Close menu on "mouseup" instead of on "click" events in the document MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "click" events are handled by several elements in user settings, and some of them (like the edit icon in the user name) stop the propagation of the event. Due to this the event never reaches the document and thus the menu was not closed in those cases. "click" events are always preceded by "mouseup" events (as "click" events are generated when "mousedown" and "mouseup" events occur in the same element), so now the menu is closed when a "mouseup" is received in the document. The described problem would happen too if an element stopped the propagation of the "mouseup" event; currently no element does that in the user settings, so now the menu is always closed as expected. Signed-off-by: Daniel Calviño Sánchez --- settings/js/users/users.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings/js/users/users.js b/settings/js/users/users.js index 7b98af985ac0e..1d6cb93452ad9 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -970,7 +970,7 @@ $(document).ready(function () { $tr.addClass('active'); }); - $(document.body).click(function () { + $(document).on('mouseup', function () { $('#userlist tr.active').removeClass('active'); $('#userlist .popovermenu.open').removeClass('open'); });