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

Set cursor position past the last character on input fields within modal

Aaron Contreras2451838251d5
diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/progress/focus-field.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/progress/focus-field.controller.ts
index 9038e58b84f..490e52c1721 100644
--- a/frontend/src/stimulus/controllers/dynamic/work-packages/progress/focus-field.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/work-packages/progress/focus-field.controller.ts
@@ -40,6 +40,14 @@ export default class FocusFieldController extends Controller {
connect() {
if (this.fieldToFocusTarget) {
this.fieldToFocusTarget.focus();
+ this.setCursorPositionToEndOfInput();
}
}
+
+ private setCursorPositionToEndOfInput() {
+ this.fieldToFocusTarget.setSelectionRange(
+ this.fieldToFocusTarget.value.length,
+ this.fieldToFocusTarget.value.length,
+ );
+ }
}