From 02ccd1dbc1d98bbd4176649f49b75433b63dcdff Mon Sep 17 00:00:00 2001 From: MartinSchoeler Date: Thu, 18 Jun 2026 16:34:03 -0300 Subject: [PATCH 1/2] fix: Composer AutoGrow causing the message list to shift --- .../room/MessageList/hooks/useKeepAtBottom.ts | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/apps/meteor/client/views/room/MessageList/hooks/useKeepAtBottom.ts b/apps/meteor/client/views/room/MessageList/hooks/useKeepAtBottom.ts index 24bb2aa5499f4..d0137f8f24797 100644 --- a/apps/meteor/client/views/room/MessageList/hooks/useKeepAtBottom.ts +++ b/apps/meteor/client/views/room/MessageList/hooks/useKeepAtBottom.ts @@ -15,13 +15,14 @@ export const useKeepAtBottom = (isAtBottom: MutableRefObject) => const keepAtBottomRef = useSafeRefCallback( useCallback( (node: HTMLDivElement) => { + const sendToBottom = () => { + if (isAtBottom.current && handleRef.current) { + handleRef.current(); + } + }; const listWrapper = node.firstChild; const observer = new ResizeObserver(() => { - if (isAtBottom.current) { - if (handleRef.current) { - handleRef.current(); - } - } + sendToBottom(); }); observer.observe(node); @@ -29,8 +30,20 @@ export const useKeepAtBottom = (isAtBottom: MutableRefObject) => observer.observe(listWrapper); } + const sendToBottomEvent = (e: Event) => { + if (!(e.target instanceof HTMLElement)) return; + if (!e.target.closest('.rc-message-box')) return; + sendToBottom(); + }; + + // Workaround for height hack in useAutoGrow + // node.style.height = '0'; + // node.style.height = `${node.scrollHeight}px`; + window.addEventListener('input', sendToBottomEvent); + return () => { observer.disconnect(); + window.removeEventListener('input', sendToBottomEvent); }; }, [isAtBottom], From edc204b6c9caecceeb8bd92b81e2adfffb9c7433 Mon Sep 17 00:00:00 2001 From: Martin Schoeler Date: Thu, 18 Jun 2026 17:00:59 -0300 Subject: [PATCH 2/2] chore: changeset --- .changeset/famous-birds-join.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/famous-birds-join.md diff --git a/.changeset/famous-birds-join.md b/.changeset/famous-birds-join.md new file mode 100644 index 0000000000000..09cc78ba0d86e --- /dev/null +++ b/.changeset/famous-birds-join.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": patch +--- + +Fixes the message list shifting when typing in the fully expanded message composer