Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

ui_utils: Update `place_caret_at_end` to properly handle text area input.

PieterCKdb4328236bbd
diff --git a/web/src/ui_util.ts b/web/src/ui_util.ts
index d9df0534a0d..f51eae91314 100644
--- a/web/src/ui_util.ts
+++ b/web/src/ui_util.ts
@@ -12,7 +12,7 @@ import * as keydown_util from "./keydown_util.ts";
// https://stackoverflow.com/questions/4233265/contenteditable-set-caret-at-the-end-of-the-text-cross-browser
export function place_caret_at_end(el: HTMLElement): void {
el.focus();
- if (el instanceof HTMLInputElement) {
+ if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) {
el.setSelectionRange(el.value.length, el.value.length);
} else {
const range = document.createRange();