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

[#64851] only show the hover card with mouse over the trigger

Tobias Dillmann81b17e18811b
diff --git a/frontend/src/stimulus/controllers/hover-card-trigger.controller.ts b/frontend/src/stimulus/controllers/hover-card-trigger.controller.ts
index dd4fe4afbca..e1ba36836fc 100644
--- a/frontend/src/stimulus/controllers/hover-card-trigger.controller.ts
+++ b/frontend/src/stimulus/controllers/hover-card-trigger.controller.ts
@@ -44,6 +44,7 @@ export default class HoverCardTriggerController extends ApplicationController {
private readonly triggerTargets:HTMLElement[];
private mouseInModal = false;
+ private mouseIsHoveringOverTrigger = false;
private hoverTimeout:number|null = null;
private closeTimeout:number|null = null;
private previousTarget:HTMLElement|null = null;
@@ -103,6 +104,7 @@ export default class HoverCardTriggerController extends ApplicationController {
private onMouseLeave() {
this.clearHoverTimer();
this.mouseInModal = false;
+ this.mouseIsHoveringOverTrigger = false;
this.closeAfterTimeout();
}
@@ -127,6 +129,8 @@ export default class HoverCardTriggerController extends ApplicationController {
el = trigger;
}
+ this.mouseIsHoveringOverTrigger = true;
+
if (this.previousTarget && this.previousTarget === el) {
// Re-entering the trigger counts as hovering over the card:
this.mouseInModal = true;
@@ -156,6 +160,8 @@ export default class HoverCardTriggerController extends ApplicationController {
if (!this.element.contains(el)) { return; }
// Do not try to show two hover cards at the same time.
if (this.isShowingHoverCard) { return; }
+ // The mouse might have left the trigger while we were waiting for the hover delay.
+ if (!this.mouseIsHoveringOverTrigger) { return; }
this.loadAndShowHoverCard(el, turboFrameUrl);
}
@@ -205,8 +211,6 @@ export default class HoverCardTriggerController extends ApplicationController {
this.mouseInModal = false;
}
- // It is important to check if we are currently showing a hover card. If we closed the modal service without
- // doing so, we might accidentally close another modal (e.g. share dialog).
if (this.isShowingHoverCard && !this.mouseInModal) {
this.getAndResetOverlay();