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

[65132] Avoid eating characters when modifying duration in work package date picker

Christophe Bliard4e400c4b52d2
diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/date-picker/preview.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/date-picker/preview.controller.ts
index 1d31e91cfde..a62d4675372 100644
--- a/frontend/src/stimulus/controllers/dynamic/work-packages/date-picker/preview.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/date-picker/preview.controller.ts
@@ -317,8 +317,12 @@ export default class PreviewController extends DialogPreviewController {
this.updateFlatpickrCalendar();
}
+ // Must be true for duration field to avoid modifying the value while the user
+ // is typing or pressing backspace.
+ // Must be false for start and finish date fields to allow value to be
+ // corrected if the date is invalid (non-working day for instance).
ignoreActiveValueWhenMorphing():boolean {
- return false;
+ return document.activeElement?.id === 'work_package_duration';
}
readInitialValues() {