OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Use capturing event to close menus. Thus we are sure, that they are always closed on a click on the outside content. Overlapping canvas like the onboarding tour are thus excluded. The bubbling event was sometimes catched by other elements and the propagation stopped.
Henriette Dingerdd9da62ca620
diff --git a/app/assets/javascripts/top_menu.js b/app/assets/javascripts/top_menu.jsindex fc0fd168369..54c379b307a 100644--- a/app/assets/javascripts/top_menu.js+++ b/app/assets/javascripts/top_menu.js@@ -36,11 +36,10 @@TopMenu.prototype = $.extend(TopMenu.prototype, {setup: function () {- var self = this;this.hover = false;this.menuIsOpen = false;this.withHeadingFoldOutAtBorder();- this.setupDropdownHoverAndClick();+ this.setupDropdownClick();this.registerEventHandlers();this.closeOnBodyClick();this.accessibility();@@ -97,11 +96,11 @@closeOnBodyClick: function () {var self = this;- $('html').click(function() {- if (self.menuIsOpen) {+ document.getElementById('wrapper').addEventListener('click', function (evt) {+ if (self.menuIsOpen && !self.openDropdowns()[0].contains(evt.target)) {self.closing();}- });+ }, true);},openDropdowns: function () {@@ -125,7 +124,7 @@}},- setupDropdownHoverAndClick: function () {+ setupDropdownClick: function () {var self = this;this.dropdowns().each(function (ix, it) {$(it).click(function () {diff --git a/frontend/src/app/components/op-context-menu/op-context-menu.service.ts b/frontend/src/app/components/op-context-menu/op-context-menu.service.tsindex cdf20bbf40b..d3639e0b492 100644--- a/frontend/src/app/components/op-context-menu/op-context-menu.service.ts+++ b/frontend/src/app/components/op-context-menu/op-context-menu.service.ts@@ -49,11 +49,12 @@ export class OPContextMenuService {});// Listen to any click and close the active context menu- jQuery(window).on('click', (evt:JQuery.TriggeredEvent) => {- if (this.active && evt.button !== 2 && !this.portalHostElement.contains(evt.target as Element)) {- this.close();+ const that = this;+ document.getElementById('wrapper')!.addEventListener('click', function(evt:Event) {+ if (that.active && !that.portalHostElement.contains(evt.target as Element)) {+ that.close();}- });+ }, true);}/**