From 2ffc86acc3b5299527d9bfcbc6292bc2bf9f398e Mon Sep 17 00:00:00 2001 From: Jonas Jabari Date: Thu, 5 Dec 2024 15:11:35 +0100 Subject: [PATCH 1/2] [#59458] Activity tab does not scroll to the bottom or correct comment on mobile https://community.openproject.org/work_packages/59458 From 32f348469c906a31ac8606a16cc885c2514f88f2 Mon Sep 17 00:00:00 2001 From: Jonas Jabari Date: Thu, 5 Dec 2024 15:15:37 +0100 Subject: [PATCH 2/2] fix scrolling issue on mobile --- .../work-packages/activities-tab/index.controller.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts index 9df5c036f223..6df9b96efd35 100644 --- a/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts +++ b/frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts @@ -358,9 +358,18 @@ export default class IndexController extends Controller { private tryScroll(activityId:string, attempts:number, maxAttempts:number) { const scrollableContainer = this.getScrollableContainer(); const activityElement = document.getElementById(`activity-anchor-${activityId}`); + const topPadding = 70; if (activityElement && scrollableContainer) { - scrollableContainer.scrollTop = activityElement.offsetTop - 70; + scrollableContainer.scrollTop = 0; + + setTimeout(() => { + const containerRect = scrollableContainer.getBoundingClientRect(); + const elementRect = activityElement.getBoundingClientRect(); + const relativeTop = elementRect.top - containerRect.top; + + scrollableContainer.scrollTop = relativeTop - topPadding; + }, 50); } else if (attempts < maxAttempts) { setTimeout(() => this.tryScroll(activityId, attempts + 1, maxAttempts), 1000); }