review: Fix chrome inconsistent scroll and firefox scroll to bottom

328e3622f2340f9516723b0df9d7b23e545eb975

Joe <joenunezb@gmail.com>

1 files changed, +5 -13Showing whitespace changes
public/scripts/RossAscends-mods.js+5 -13
@@ -699,26 +699,18 @@ const chatBlock = document.getElementById('chat');
699699const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
700700
701701/**
702702 * Auto-resizesResizes the sendchat messageinput textarea vertically to fitmatch its text content, up to a maximum height defined byin CSS.
703703 * ThisPreserves functionscroll preservesposition chatin scrollChrome. position,In resetsFirefox, the textarea heightgrows forto accuratecover measurement,the chat history.
704- * calculates the required height, sets the new height, and then restores the chat scroll position.
705- * Firefox-specific scrolling adjustments are included for smoother behavior.
706704 */
707705function autoFitSendTextArea() {
708706 const originalScrollToporiginalScrollBottom = chatBlock.scrollHeight - (chatBlock.scrollTop + chatBlock.offsetHeight);
709- const originalScrollHeight = chatBlock.scrollHeight;
710-
711- sendTextArea.style.height = '1px';
712707
708+ sendTextArea.style.height = '1px'; // Reset height to 1px to force recalculation of scrollHeight
713709 const newHeight = sendTextArea.scrollHeight;
714-
715710 sendTextArea.style.height = `${newHeight}px`;
716711
717- // Restore chat scroll position (Firefox-specific adjustment for smoothness).
718712 if (!isFirefox) {
719713 chatBlock.scrollTop = originalScrollTopchatBlock.scrollHeight +- (chatBlock.scrollHeightoffsetHeight -+ originalScrollHeightoriginalScrollBottom);
720- } else {
721- chatBlock.scrollTo({ top: chatBlock.scrollHeight, behavior: 'auto' });
722714 }
723715}
724716export const autoFitSendTextAreaDebounced = debounce(autoFitSendTextArea, debounce_timeout.short);