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

Scrolling previous row working (#8532)

Aleix Suau042fd2895d74
diff --git a/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.ts b/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.ts
index fec78949175..6453abfabad 100644
--- a/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.ts
+++ b/frontend/src/app/modules/work_packages/routing/wp-list-view/wp-list-view.component.ts
@@ -129,11 +129,17 @@ export class WorkPackageListViewComponent extends UntilDestroyedMixin implements
// detection on the entire app
this.ngZone.runOutsideAngular(() => {
setTimeout(() => {
- const selectedElement = this.elementRef.nativeElement.querySelector('.wp-table--row.-checked') ||
- this.elementRef.nativeElement.querySelector('.wp-card.-checked');
+ const selectedRow = this.elementRef.nativeElement.querySelector('.wp-table--row.-checked');
+ const selectedCard = this.elementRef.nativeElement.querySelector('.wp-card.-checked');
- if (selectedElement) {
- selectedElement.scrollIntoView({block: "start"});
+ // The header of the table hides the scrolledIntoView element
+ // so we scrollIntoView the previous element, if any
+ if (selectedRow && selectedRow.previousSibling) {
+ selectedRow.previousSibling.scrollIntoView({block: "start"});
+ }
+
+ if (selectedCard) {
+ selectedCard.scrollIntoView({block: "start"});
}
}, 0);
});