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

adjusted agenda item form controller following the adjustments made in the section controller in order to get a homogenous behaviour

Jonas Jabaric6fe901d0fb1
diff --git a/frontend/src/stimulus/controllers/dynamic/meeting-agenda-item-form.controller.ts b/frontend/src/stimulus/controllers/dynamic/meeting-agenda-item-form.controller.ts
index 8044ac14d65..786c4b0a441 100644
--- a/frontend/src/stimulus/controllers/dynamic/meeting-agenda-item-form.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/meeting-agenda-item-form.controller.ts
@@ -51,12 +51,11 @@ export default class extends Controller {
focusInput():void {
const titleInput = this.element.querySelector('input[name="meeting_agenda_item[title]"]');
- setTimeout(() => {
- this.element.scrollIntoView({ block: 'center' });
- if (titleInput) {
- (titleInput as HTMLInputElement).focus();
- }
- }, 100);
+ this.element.scrollIntoView({ block: 'center' });
+ if (titleInput) {
+ (titleInput as HTMLInputElement).focus();
+ this.setCursorAtEnd(titleInput as HTMLInputElement);
+ }
}
async cancel() {
@@ -77,4 +76,11 @@ export default class extends Controller {
addNotes() {
this.notesInputTarget.classList.remove('d-none');
}
+
+ setCursorAtEnd(inputElement:HTMLInputElement):void {
+ if (document.activeElement === inputElement) {
+ const valueLength = inputElement.value.length;
+ inputElement.setSelectionRange(valueLength, valueLength);
+ }
+ }
}
diff --git a/frontend/src/stimulus/controllers/dynamic/meeting-section-form.controller.ts b/frontend/src/stimulus/controllers/dynamic/meeting-section-form.controller.ts
index f1e9545e9a8..9906a1f3a78 100644
--- a/frontend/src/stimulus/controllers/dynamic/meeting-section-form.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/meeting-section-form.controller.ts
@@ -70,5 +70,5 @@ export default class extends Controller {
const valueLength = inputElement.value.length;
inputElement.setSelectionRange(valueLength, valueLength);
}
-}
+ }
}