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

fix scrolling issue on mobile

Jonas Jabari32f348469c90
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 9df5c036f22..6df9b96efd3 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);
}