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

Add timeout before focusing on title field

Mir Bhatia5087ded7cea1
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 b00f3222902..7e24228b37c 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
@@ -52,8 +52,10 @@ export default class extends Controller {
const titleInput = this.element.querySelector('input[name="meeting_agenda_item[title]"]');
if (titleInput && this.autofocusValue) {
- (titleInput as HTMLInputElement).focus();
- this.setCursorAtEnd(titleInput as HTMLInputElement);
+ setTimeout(() => {
+ (titleInput as HTMLInputElement).focus();
+ this.setCursorAtEnd(titleInput as HTMLInputElement);
+ }, 25); // Magic number - unsure why, but fixes the issue of focus sometimes not being on the input
}
}