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

create a stimulus controller to handel scroll in the relations tab

Behrokh Satarnejad5cc1f055f66c
diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/relations-tab/scroll.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/relations-tab/scroll.controller.ts
new file mode 100644
index 00000000000..264732e1b6e
--- /dev/null
+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/relations-tab/scroll.controller.ts
@@ -0,0 +1,17 @@
+import { Controller } from '@hotwired/stimulus';
+
+export default class ScrollController extends Controller {
+ static values = { targetId: String };
+ declare targetIdValue:string;
+
+ connect() {
+ setTimeout(() => {
+ if (this.targetIdValue) {
+ const element = document.querySelector(`[data-test-selector='op-relation-row-${this.targetIdValue}']`) as HTMLElement;
+ if (element) {
+ element.scrollIntoView({ behavior: 'smooth', block: 'center' });
+ }
+ }
+ });
+ }
+}