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

Reposition the modal after the calendar is drawn since it affects the modal height and could thus overlap the window border in some cases

Henriette Dargedd15f7b97035
diff --git a/frontend/src/app/shared/components/datepicker/datepicker.modal.ts b/frontend/src/app/shared/components/datepicker/datepicker.modal.ts
index d740768d250..00ae8718fb6 100644
--- a/frontend/src/app/shared/components/datepicker/datepicker.modal.ts
+++ b/frontend/src/app/shared/components/datepicker/datepicker.modal.ts
@@ -55,10 +55,8 @@ import {
} from 'flatpickr/dist/types/instance';
import flatpickr from 'flatpickr';
import { DatepickerModalService } from 'core-app/shared/components/datepicker/datepicker.modal.service';
-import {
- map,
- take,
-} from 'rxjs/operators';
+import { take } from 'rxjs/operators';
+import { activeFieldContainerClassName } from 'core-app/shared/components/fields/edit/edit-form/edit-form';
export type DateKeys = 'date'|'start'|'end';
@@ -247,6 +245,7 @@ export class DatePickerModalComponent extends OpModalComponent implements AfterV
inline: true,
onReady: (selectedDates, dateStr, instance) => {
this.toggleDisabledState(instance);
+ this.reposition(jQuery(this.modalContainer.nativeElement), jQuery(`.${activeFieldContainerClassName}`));
},
onChange: (dates:Date[]) => {
this.handleDatePickerChange(dates);
diff --git a/spec/features/work_packages/table/scheduling/manual_scheduling_spec.rb b/spec/features/work_packages/table/scheduling/manual_scheduling_spec.rb
index 4405ea011ea..3e60583f507 100644
--- a/spec/features/work_packages/table/scheduling/manual_scheduling_spec.rb
+++ b/spec/features/work_packages/table/scheduling/manual_scheduling_spec.rb
@@ -98,6 +98,7 @@ describe 'Manual scheduling', js: true do
start_date.toggle_scheduling_mode
start_date.expect_scheduling_mode manually: true
+ start_date.expect_calendar
# Expect not editable
start_date.within_modal do
diff --git a/spec/support/edit_fields/date_edit_field.rb b/spec/support/edit_fields/date_edit_field.rb
index e04abc99ee3..0fa9f322f6b 100644
--- a/spec/support/edit_fields/date_edit_field.rb
+++ b/spec/support/edit_fields/date_edit_field.rb
@@ -89,6 +89,12 @@ class DateEditField < EditField
expect(page).to have_no_selector("#{modal_selector} #{input_selector}")
end
+ def expect_calendar
+ within_modal do
+ expect(page).to have_selector(".flatpickr-calendar")
+ end
+ end
+
def update(value, save: true, expect_failure: false)
# Retry to set attributes due to reloading the page after setting
# an attribute, which may cause an input not to open properly.