From b567a4fc69b1b1ece7281dd3926d2248c3d9cf74 Mon Sep 17 00:00:00 2001 From: "sakarora@adobe.com" Date: Tue, 10 Jun 2025 11:13:56 +0530 Subject: [PATCH] Fixing positional enter in text area. --- .../v1/textinput/clientlibs/site/js/textinputview.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/textinput/v1/textinput/clientlibs/site/js/textinputview.js b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/textinput/v1/textinput/clientlibs/site/js/textinputview.js index 3b49a906ed..3a7d2972cb 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/textinput/v1/textinput/clientlibs/site/js/textinputview.js +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/textinput/v1/textinput/clientlibs/site/js/textinputview.js @@ -87,7 +87,11 @@ // Prevent default action of Enter key to avoid form submission event.preventDefault(); // Append a newline character to the widget value - this.widget.value = this.widget.value + '\n'; + let cursorPosition = this.widget.selectionStart; + let textBefore = this.widget.value.substring(0, cursorPosition); + let textAfter = this.widget.value.substring(this.widget.selectionEnd); + this.widget.value = textBefore + '\n' + textAfter; + this.widget.selectionStart = this.widget.selectionEnd = cursorPosition + 1; } }); }