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

Merge branch 'dev' into feature/60875-introduce-comment-copy-link-drawn-from-the-comment-id-replacing-sequenced-activity-numbers

Kabiru Mwenja08a76249a679
diff --cc frontend/src/stimulus/controllers/dynamic/work-packages/activities-tab/index.controller.ts
index 08a9194784e,e6735e9e386..4adad055b82
--- 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
@@@ -366,9 -358,9 +366,9 @@@ export default class IndexController ex
}
}
- private tryScroll(activityId:string, attempts:number, maxAttempts:number) {
+ private tryScroll(activityAnchorName:AnchorType, activityId:string, attempts:number, maxAttempts:number) {
const scrollableContainer = this.getScrollableContainer();
- const activityElement = document.querySelector(`[data-anchor-${activityAnchorName}-id="${activityId}"]`);
- const activityElement = document.getElementById(`activity-anchor-${activityId}`);
++ const activityElement = this.getActivityAnchorElement(activityAnchorName, activityId);
const topPadding = 70;
if (activityElement && scrollableContainer) {
@@@ -436,11 -428,20 +436,23 @@@
setAnchor(event:CustomEventWithIdParam) {
// native anchor scroll is causing positioning issues
event.preventDefault();
++
const activityId = event.params.id;
+ const anchorName = event.params.anchorName;
- this.scrollToActivity(anchorName, activityId);
+ // not using the scrollToActivity method here as it is causing flickering issues
+ // in case of a setAnchor click, we can go for a direct scroll approach
+ const scrollableContainer = this.getScrollableContainer();
- const activityElement = document.getElementById(`activity-anchor-${activityId}`);
++ const activityElement = this.getActivityAnchorElement(anchorName, activityId);
+
+ if (scrollableContainer && activityElement) {
+ scrollableContainer.scrollTo({
+ top: activityElement.offsetTop - 90,
+ behavior: 'smooth',
+ });
+ }
- window.location.hash = `#activity-${activityId}`;
++
+ window.location.hash = `#${anchorName}-${activityId}`;
}
private getCkEditorElement():HTMLElement | null {
@@@ -469,6 -470,6 +481,10 @@@
return document.querySelector('.tabcontent') as HTMLElement;
}
++ private getActivityAnchorElement(activityAnchorName:AnchorType, activityId:string):HTMLElement | null {
++ return document.querySelector(`[data-anchor-${activityAnchorName}-id="${activityId}"]`);
++ }
++
// Code Maintenance: Get rid of this JS based view port checks when activities are rendered in fully primierized activity tab in all contexts
private isMobile():boolean {
return window.innerWidth < 1279;