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 -7Ignore whitespace
public/scripts/RossAscends-mods.js+4 -7
@@ -703,16 +703,13 @@ const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
703 */703 */
704function autoFitSendTextArea() {704function autoFitSendTextArea() {
705 const originalScrollBottom = chatBlock.scrollHeight - (chatBlock.scrollTop + chatBlock.offsetHeight);705 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;
711 sendTextArea.style.height = `${newHeight}px`;709 sendTextArea.style.height = `${newHeight}px`;
712710
713 if (!isFirefox) {711 if (!isFirefox) {
714 const newScrollTop = Math.round(chatBlock.scrollHeight - (chatBlock.offsetHeight + originalScrollBottom));712 chatBlock.scrollTop = chatBlock.scrollHeight - (chatBlock.offsetHeight + originalScrollBottom);
715 chatBlock.scrollTop = newScrollTop;
716 }713 }
717}714}
718export const autoFitSendTextAreaDebounced = debounce(autoFitSendTextArea, debounce_timeout.short);715export const autoFitSendTextAreaDebounced = debounce(autoFitSendTextArea, debounce_timeout.short);