Actions
Feature #40556
closedFocus on the textarea after clicking the Edit Journal button
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Description
I suggest adding the feature to focus on the textarea after clicking on the Edit Journal button.
Here is a simple patch as follows.
diff --git a/app/views/journals/edit.js.erb b/app/views/journals/edit.js.erb
index 96cf6b4f8..49fe4bec0 100644
--- a/app/views/journals/edit.js.erb
+++ b/app/views/journals/edit.js.erb
@@ -6,3 +6,13 @@ if ($("form#journal-<%= @journal.id %>-form").length > 0) {
} else {
$("#journal-<%= @journal.id %>-notes").after('<%= escape_javascript(render :partial => 'notes_form') %>');
}
+
+// Focus on the textarea
+(() => {
+ const $textarea = $("#journal-<%= @journal.id %>-form .wiki-edit");
+ if ($textarea.length > 0) {
+ $textarea.focus();
+ const textareaLength = $textarea.val().length;
+ $textarea.get(0).setSelectionRange(textareaLength, textareaLength);
+ }
+})();
Updated by Marius BĂLTEANU 7 months ago
- Status changed from New to Resolved
- Assignee set to Marius BĂLTEANU
- Target version set to 5.0.9
Patch committed, thanks!
Actions