Merge pull request #3006 from joenunezb/fix-textarea-width-bug Fix: Inconsistent Textarea resizing in small width windows

7aad053e709b1f48612225fa774924798d28d019

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
1 files changed, +4 -7Showing whitespace changes
public/scripts/RossAscends-mods.js+4 -7
@@ -703,16 +703,13 @@ const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
703703 */
704704function autoFitSendTextArea() {
705705 const originalScrollBottom = chatBlock.scrollHeight - (chatBlock.scrollTop + chatBlock.offsetHeight);
706- if (Math.ceil(sendTextArea.scrollHeight + 3) >= Math.floor(sendTextArea.offsetHeight)) {
706+
707- const sendTextAreaMinHeight = '0px';
707+ sendTextArea.style.height = '1px'; // Reset height to 1px to force recalculation of scrollHeight
708- sendTextArea.style.height = sendTextAreaMinHeight;
708+ const newHeight = sendTextArea.scrollHeight;
709- }
710- const newHeight = sendTextArea.scrollHeight + 3;
711709 sendTextArea.style.height = `${newHeight}px`;
712710
713711 if (!isFirefox) {
714712 const newScrollTopchatBlock.scrollTop = Math.round(chatBlock.scrollHeight - (chatBlock.offsetHeight + originalScrollBottom));
715- chatBlock.scrollTop = newScrollTop;
716713 }
717714}
718715export const autoFitSendTextAreaDebounced = debounce(autoFitSendTextArea, debounce_timeout.short);