Skip to content

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

[#55581] do not show the same modal twice

Tobias Dillmannc37731e43c98
diff --git a/app/components/users/avatar_component.rb b/app/components/users/avatar_component.rb
index ba47f78685c..e278af3be3b 100644
--- a/app/components/users/avatar_component.rb
+++ b/app/components/users/avatar_component.rb
@@ -64,7 +64,7 @@ module Users
}
if @hover_card
- options[:hover_card_close_delay] = 600
+ options[:hover_card_close_delay] = 250
options[:hover_card_alignment] = "top"
end
diff --git a/frontend/src/app/core/setup/globals/global-listeners/hover-card-trigger.service.ts b/frontend/src/app/core/setup/globals/global-listeners/hover-card-trigger.service.ts
index e7e03704d1b..7241dab47a9 100644
--- a/frontend/src/app/core/setup/globals/global-listeners/hover-card-trigger.service.ts
+++ b/frontend/src/app/core/setup/globals/global-listeners/hover-card-trigger.service.ts
@@ -36,9 +36,10 @@ export class HoverCardTriggerService {
private modalElement:HTMLElement;
private mouseInModal = false;
- private closeTimeout:number|null;
+ private closeTimeout:number|null = null;
private closeDelayInMs:number = 100;
- private modalAlignment?:string|null;
+ private modalAlignment:string|null = null;
+ private previousTarget:HTMLElement|null = null;
constructor(
readonly opModalService:OpModalService,
@@ -55,6 +56,12 @@ export class HoverCardTriggerService {
const el = e.target as HTMLElement;
if (!el) { return; }
+ // Abort if the current element is already showing a modal
+ if (this.previousTarget && this.previousTarget === el) {
+ return;
+ }
+ this.previousTarget = el;
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const turboFrameUrl = el.getAttribute('data-hover-card-url');
if (!turboFrameUrl) { return; }
@@ -111,6 +118,8 @@ export class HoverCardTriggerService {
this.closeTimeout = window.setTimeout(() => {
if (!this.mouseInModal) {
this.opModalService.close();
+ // Allow opening this target once more, since it has been orderly closed
+ this.previousTarget = null;
}
}, this.closeDelayInMs);
});