From ff8a761b67d2d4b0a98f6952d648210c38ba5443 Mon Sep 17 00:00:00 2001 From: Dombi Attila Date: Mon, 25 Jul 2022 18:02:16 +0200 Subject: [PATCH] [#43311] (Mobile) Clicking on notification row does not scroll to activity https://community.openproject.org/work_packages/43311 --- .../activity-panel/activity-base.controller.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts index 6f598ec372..0f4a451b30 100644 --- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts +++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts @@ -73,6 +73,8 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements private initialized = false; + private comingFromNotifications = false; + constructor( readonly apiV3Service:ApiV3Service, readonly I18n:I18nService, @@ -86,6 +88,12 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements this.reverse = wpActivity.isReversed; this.togglerText = this.text.commentsOnly; + + const lastTransitionName = uiRouterGlobals.successfulTransitions.peekTail().from().name as string; + + if (/^notifications/.test(lastTransitionName)) { + this.comingFromNotifications = true; + } } ngOnInit():void { @@ -189,6 +197,11 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements const scrollOffset = notificationElement.offsetTop - (scrollContainer as HTMLElement).offsetTop - this.additionalScrollMargin; scrollContainer.scrollTop = scrollOffset; + + // Make sure the scrollContainer is visible on mobile + if (this.comingFromNotifications) { + scrollContainer.scrollIntoView(true); + } } public toggleComments():void {