summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2017-12-21 12:37:35 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2017-12-21 12:37:35 +0100
commit372e7acfafafaf58b6e4abdaaf13fddf2948090a (patch)
tree89f74a0120b5a06e0c4c01b050cb65271d7e531d /apps/files_sharing/js
parentdc8809e754c22addaab20401a7505dcc4082541c (diff)
downloadnextcloud-server-372e7acfafafaf58b6e4abdaaf13fddf2948090a.tar.gz
nextcloud-server-372e7acfafafaf58b6e4abdaaf13fddf2948090a.zip
Fix closing menu on second click in sharing page
When a "mouseup" event was triggered on any element except on the share menu or its descendants the share menu was closed. The share menu toggle is not a descendant of the share menu, so clicking on it when the share menu was shown closed it by removing its "open" CSS class. However, once that happened the click event was then handled by the share menu toggle, which toggled the "open" CSS class in the share menu and thus added it again. So, from the user point of view, nothing happened when clicking on the share menu toggle if the share menu was open. Now a "mouseup" event on the share menu toggle no longer closes the share menu, and thus toggling the "open" CSS class when handling the "click" event works as expected. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/files_sharing/js')
-rw-r--r--apps/files_sharing/js/public.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index 2142dec1218..ae19500080b 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -434,10 +434,13 @@ $(document).ready(function () {
$(document).mouseup(function(e) {
+ var toggle = $('#share-menutoggle');
var container = $('#share-menu');
- // if the target of the click isn't the container nor a descendant of the container
- if (!container.is(e.target) && container.has(e.target).length === 0) {
+ // if the target of the click isn't the menu toggle, nor a descendant of the
+ // menu toggle, nor the container nor a descendant of the container
+ if (!toggle.is(e.target) && toggle.has(e.target).length === 0 &&
+ !container.is(e.target) && container.has(e.target).length === 0) {
container.removeClass('open');
}
});