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

scroll to the selected activity

bsatarnejad535e36483d86
diff --git a/frontend/src/app/features/work-packages/components/wp-activity/user/user-activity.component.ts b/frontend/src/app/features/work-packages/components/wp-activity/user/user-activity.component.ts
index 4857936ba56..0211e271942 100644
--- a/frontend/src/app/features/work-packages/components/wp-activity/user/user-activity.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-activity/user/user-activity.component.ts
@@ -66,6 +66,8 @@ export class UserActivityComponent extends WorkPackageCommentFieldHandler implem
@Input() public hasUnreadNotification:boolean;
+ private additionalScrollMargin = 200;
+
public userCanEdit = false;
public userCanQuote = false;
@@ -146,9 +148,12 @@ export class UserActivityComponent extends WorkPackageCommentFieldHandler implem
});
if (window.location.hash === `#activity-${this.activityNo}`) {
+ const activityElement = document.querySelectorAll(`[data-qa-activity-number='${this.activityNo}']`)[0] as HTMLElement;
+ const scrollContainer = document.querySelectorAll("[data-notification-selector='notification-scroll-container']")[0];
+ const scrollOffset = activityElement.offsetTop - (scrollContainer as HTMLElement).offsetTop - this.additionalScrollMargin;
this.ngZone.runOutsideAngular(() => {
setTimeout(() => {
- this.elementRef.nativeElement.scrollIntoView(true);
+ scrollContainer.scrollTop = scrollOffset;
});
});
}