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
Accurate ScrollIntoView with SetTimeOut
Aleix Suau84173af043a0
diff --git a/frontend/src/app/components/wp-activity/user/user-activity.component.ts b/frontend/src/app/components/wp-activity/user/user-activity.component.tsindex 4cc4644c4ce..12c11ea66c4 100644--- a/frontend/src/app/components/wp-activity/user/user-activity.component.ts+++ b/frontend/src/app/components/wp-activity/user/user-activity.component.ts@@ -32,13 +32,12 @@ import {ConfigurationService} from 'core-app/modules/common/config/configurationimport {WorkPackageResource} from 'core-app/modules/hal/resources/work-package-resource';import {WorkPackagesActivityService} from 'core-components/wp-single-view-tabs/activity-panel/wp-activity.service';import {- AfterViewInit,ChangeDetectionStrategy,ChangeDetectorRef,Component,ElementRef,Injector,- Input,+ Input, NgZone,OnInit} from "@angular/core";import {CommentService} from "core-components/wp-activity/comment-service";@@ -53,7 +52,7 @@ import {APIV3Service} from "core-app/modules/apiv3/api-v3.service";changeDetection: ChangeDetectionStrategy.OnPush,templateUrl: './user-activity.component.html'})-export class UserActivityComponent extends WorkPackageCommentFieldHandler implements OnInit, AfterViewInit {+export class UserActivityComponent extends WorkPackageCommentFieldHandler implements OnInit {@Input() public workPackage:WorkPackageResource;@Input() public activity:HalResource;@Input() public activityNo:number;@@ -91,7 +90,8 @@ export class UserActivityComponent extends WorkPackageCommentFieldHandler implemreadonly ConfigurationService:ConfigurationService,readonly apiV3Service:APIV3Service,readonly cdRef:ChangeDetectorRef,- readonly I18n:I18nService) {+ readonly I18n:I18nService,+ readonly ngZone:NgZone) {super(elementRef, injector);}@@ -126,18 +126,20 @@ export class UserActivityComponent extends WorkPackageCommentFieldHandler implemthis.userAvatar = user.avatar;this.cdRef.detectChanges();});++ if (window.location.hash === `#activity-${this.activityNo}`) {+ this.ngZone.runOutsideAngular(() => {+ setTimeout(() => {+ this.elementRef.nativeElement.scrollIntoView(true);+ });+ });+ }}public shouldHideIcons():boolean {return !((this.isComment || this.isBcfComment) && this.focussing());}- public ngAfterViewInit() {- if (window.location.hash === '#activity-' + this.activityNo) {- this.elementRef.nativeElement.scrollIntoView(true);- }- }-public activate() {super.activate(this.activity.comment.raw);this.cdRef.detectChanges();