[#43311] (Mobile) Clicking on notification row does not scroll to activity

https://community.openproject.org/work_packages/43311
pull/11020/head
Dombi Attila 2 years ago
parent 82c6fbf513
commit ff8a761b67
  1. 13
      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 {

Loading…
Cancel
Save