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

Append status and relations dropdown to body for correct positioning. The dropdowns are closed when scrolling the container they are in.

Henriette Dinger0a2c235d5d18
diff --git a/app/assets/stylesheets/content/_autocomplete.sass b/app/assets/stylesheets/content/_autocomplete.sass
index a6b0578a77a..db43c8cfe17 100644
--- a/app/assets/stylesheets/content/_autocomplete.sass
+++ b/app/assets/stylesheets/content/_autocomplete.sass
@@ -179,10 +179,6 @@ mark.ui-autocomplete-match
.ng-dropdown-panel
z-index: 9500 !important
- // Fix to avoid misplacing the ng-select container
- &.-hidden-until-positioned
- display: none
-
.ng-option
font-size: 14px
line-height: 22px
diff --git a/frontend/src/app/components/wp-relations/embedded/inline/add-existing/wp-relation-inline-add-existing.component.html b/frontend/src/app/components/wp-relations/embedded/inline/add-existing/wp-relation-inline-add-existing.component.html
index 1f5cf6d6078..36c38689755 100644
--- a/frontend/src/app/components/wp-relations/embedded/inline/add-existing/wp-relation-inline-add-existing.component.html
+++ b/frontend/src/app/components/wp-relations/embedded/inline/add-existing/wp-relation-inline-add-existing.component.html
@@ -6,7 +6,8 @@
[workPackage]="workPackage"
(onSelected)="onSelected($event)"
[additionalFilters]="queryFilters"
- [filterCandidatesFor]="relationType">
+ [filterCandidatesFor]="relationType"
+ hiddenOverflowContainer=".work-packages-full-view--split-left">
</wp-relations-autocomplete>
</div>
<div class="wp-relations-controls-section relation-row">
diff --git a/frontend/src/app/components/wp-relations/wp-relations-create/wp-relation-create.template.html b/frontend/src/app/components/wp-relations/wp-relations-create/wp-relation-create.template.html
index e41f027a70a..ed07655c4cb 100644
--- a/frontend/src/app/components/wp-relations/wp-relations-create/wp-relation-create.template.html
+++ b/frontend/src/app/components/wp-relations/wp-relations-create/wp-relation-create.template.html
@@ -37,7 +37,7 @@
[workPackage]="workPackage"
(onSelected)="onSelected($event)"
(onCancel)="toggleRelationsCreateForm()"
- [appendToContainer]="'.work-packages-tab-view--overflow'"
+ [hiddenOverflowContainer]="'.work-packages-tab-view--overflow'"
[selectedRelationType]="selectedRelationType">
</wp-relations-autocomplete>
</div>
diff --git a/frontend/src/app/components/wp-relations/wp-relations-create/wp-relations-autocomplete/wp-relations-autocomplete.component.ts b/frontend/src/app/components/wp-relations/wp-relations-create/wp-relations-autocomplete/wp-relations-autocomplete.component.ts
index 0bc63290947..0e962b20d71 100644
--- a/frontend/src/app/components/wp-relations/wp-relations-create/wp-relations-autocomplete/wp-relations-autocomplete.component.ts
+++ b/frontend/src/app/components/wp-relations/wp-relations-create/wp-relations-autocomplete/wp-relations-autocomplete.component.ts
@@ -72,7 +72,7 @@ export class WorkPackageRelationsAutocomplete implements AfterContentInit {
/** Do we take the current query filters into account? */
@Input() additionalFilters:ApiV3Filter[] = [];
- @Input() appendToContainer:string = 'body';
+ @Input() hiddenOverflowContainer:string = 'body';
@ViewChild(NgSelectComponent, { static: true }) public ngSelectComponent:NgSelectComponent;
@Output() onCancel = new EventEmitter<undefined>();
@@ -85,6 +85,8 @@ export class WorkPackageRelationsAutocomplete implements AfterContentInit {
// Search input from ng-select
public searchInput$ = new Subject<string>();
+ public appendToContainer = 'body';
+
// Search results mapped to input
public results$:Observable<WorkPackageResource[]> = this.searchInput$.pipe(
debounceTime(250),
@@ -165,7 +167,14 @@ export class WorkPackageRelationsAutocomplete implements AfterContentInit {
// https://github.com/ng-select/ng-select/issues/1259
setTimeout(() => {
const component = (this.ngSelectComponent) as any;
- component.dropdownPanel._updatePosition();
+ if (component) {
+ component.dropdownPanel._updatePosition();
+ }
+
+ jQuery(this.hiddenOverflowContainer).one('scroll', () => {
+ this.ngSelectComponent.close();
+ });
}, 25);
+
}
}
diff --git a/frontend/src/app/modules/fields/edit/field-types/project-status-edit-field.component.html b/frontend/src/app/modules/fields/edit/field-types/project-status-edit-field.component.html
index 080aaeee518..9e665917259 100644
--- a/frontend/src/app/modules/fields/edit/field-types/project-status-edit-field.component.html
+++ b/frontend/src/app/modules/fields/edit/field-types/project-status-edit-field.component.html
@@ -2,11 +2,11 @@
[(ngModel)]="currentStatusCode"
bindLabel="name"
bindValue="code"
- class="project-status -hidden-until-positioned"
+ class="project-status"
(open)="onOpen()"
(close)="onClose()"
(change)="onChange()"
- [appendTo]="hiddenOverflowContainer"
+ [appendTo]="appendToContainer"
[hideSelected]="true"
[disabled]="inFlight">
<ng-template ng-label-tmp let-item="item">
diff --git a/frontend/src/app/modules/fields/edit/field-types/project-status-edit-field.component.ts b/frontend/src/app/modules/fields/edit/field-types/project-status-edit-field.component.ts
index f08d9c10b69..7f68de861e8 100644
--- a/frontend/src/app/modules/fields/edit/field-types/project-status-edit-field.component.ts
+++ b/frontend/src/app/modules/fields/edit/field-types/project-status-edit-field.component.ts
@@ -53,6 +53,7 @@ export class ProjectStatusEditFieldComponent extends EditFieldComponent implemen
});
public hiddenOverflowContainer = '#content-wrapper';
+ public appendToContainer = 'body';
ngOnInit() {
this.currentStatusCode = this.resource['status'] === null ? 'not set' : this.resource['status'];
@@ -71,19 +72,21 @@ export class ProjectStatusEditFieldComponent extends EditFieldComponent implemen
}
public onOpen() {
+ // Force reposition as a workaround for BUG
+ // https://github.com/ng-select/ng-select/issues/1259
setTimeout(() => {
- const dropdown = document.getElementById(this.ngSelectComponent.dropdownId);
- if (dropdown) {
- dropdown.classList.remove('-hidden-until-positioned');
+ const component = (this.ngSelectComponent) as any;
+ if (component.dropdownPanel) {
+ component.dropdownPanel._updatePosition();
}
- }, 25);
- jQuery(this.hiddenOverflowContainer).one('scroll', () => {
- this.ngSelectComponent.close();
- });
+ jQuery(this.hiddenOverflowContainer).one('scroll.autocompleteContainer', () => {
+ this.ngSelectComponent.close();
+ });
+ }, 25);
}
public onClose() {
- // Nothing to do
+ jQuery(this.hiddenOverflowContainer).off('scroll.autocompleteContainer');
}
}