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

Maintain the focused class on the input field between morphing responses.

Dombi Attila8870d29ade92
diff --git a/app/forms/projects/life_cycles/form.rb b/app/forms/projects/life_cycles/form.rb
index 89b47aea530..86437b238c5 100644
--- a/app/forms/projects/life_cycles/form.rb
+++ b/app/forms/projects/life_cycles/form.rb
@@ -55,7 +55,7 @@ module Projects::LifeCycles
clear_button_id: "#{field_name}_clear_button",
inset: true,
data: {
- action: "focusin->overview--project-life-cycles-form#onHighlightField " \
+ action: "focus->overview--project-life-cycles-form#onHighlightField " \
"overview--project-life-cycles-form#previewForm ",
"overview--project-life-cycles-form-target": field_name.to_s.camelize(:lower)
},
diff --git a/frontend/src/stimulus/controllers/dynamic/overview/project-life-cycles-form.controller.ts b/frontend/src/stimulus/controllers/dynamic/overview/project-life-cycles-form.controller.ts
index c8418f52b87..c99a441e38e 100644
--- a/frontend/src/stimulus/controllers/dynamic/overview/project-life-cycles-form.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/overview/project-life-cycles-form.controller.ts
@@ -128,7 +128,10 @@ export default class ProjectLifeCyclesFormController extends FormPreviewControll
preventValueMorphingActiveElement(event:CustomEvent<{ attributeName:string }>) {
const target = event.target as HTMLInputElement;
- if (target?.id === document.activeElement?.id && event.detail.attributeName === 'value') {
+ const { attributeName } = event.detail;
+ const isActiveElement = this.highlightedField && this.highlightedField.id === target?.id;
+
+ if (isActiveElement && ['value', 'class'].includes(attributeName)) {
event.preventDefault();
}
}