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

[#59925] allow hover card to open even when mouse cursor is jittering

Tobias Dillmann287e214cb23e
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 400c441bf52..5b417b0a902 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
@@ -76,7 +76,6 @@ export class HoverCardTriggerService {
// Hovering over a new target. Close the old one (if any).
this.close(true);
- this.previousTarget = el;
const turboFrameUrl = this.parseHoverCardUrl(el);
if (!turboFrameUrl) { return; }
@@ -84,10 +83,7 @@ export class HoverCardTriggerService {
// Reset close timer for when hovering over multiple triggers in quick succession.
// A timer from a previous hover card might still be running. We do not want it to
// close the new (i.e. this) hover card.
- if (this.closeTimeout) {
- clearTimeout(this.closeTimeout);
- this.closeTimeout = null;
- }
+ this.clearCloseTimer();
// Set a delay before showing the hover card
this.hoverTimeout = window.setTimeout(() => {
@@ -133,6 +129,7 @@ export class HoverCardTriggerService {
modal?.subscribe((previewModal) => {
this.isShowingHoverCard = true;
+ this.previousTarget = el;
this.modalElement = previewModal.elementRef.nativeElement as HTMLElement;
previewModal.alignment = 'top';
@@ -148,6 +145,13 @@ export class HoverCardTriggerService {
}
}
+ private clearCloseTimer() {
+ if (this.closeTimeout) {
+ clearTimeout(this.closeTimeout);
+ this.closeTimeout = null;
+ }
+ }
+
private closeAfterTimeout() {
this.ngZone.runOutsideAngular(() => {
this.closeTimeout = window.setTimeout(() => {