skip put-cursor-to-end for edits > 150 chars only

This commit is contained in:
Penar Musaraj 2024-12-13 00:13:34 -05:00
parent e09f870df4
commit a7965297bc
1 changed files with 5 additions and 2 deletions

View File

@ -3,13 +3,16 @@ import { helperContext } from "discourse-common/lib/helpers";
export default function (element) {
const caps = helperContext().capabilities;
if (caps.isIOS) {
const len = element.value.length;
// don't scroll to end of element with a lot of text in iOS
// it causes composer container to go out of viewport
if (caps.isIOS && element.tagName === "TEXTAREA" && len > 150) {
return;
}
element.focus();
const len = element.value.length;
element.setSelectionRange(len, len);
// Scroll to the bottom, in case we're in a tall textarea