From 72f2f930b1a6dc2d43d462155c325457da68d646 Mon Sep 17 00:00:00 2001 From: Sam Maselli Date: Sun, 4 Feb 2024 13:48:50 -0500 Subject: [PATCH] chatmenu scrolls down again --- client/src/menu/game/gameScreenContent/ChatMenu.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/menu/game/gameScreenContent/ChatMenu.tsx b/client/src/menu/game/gameScreenContent/ChatMenu.tsx index 1fb17ebac..40e2b50a4 100644 --- a/client/src/menu/game/gameScreenContent/ChatMenu.tsx +++ b/client/src/menu/game/gameScreenContent/ChatMenu.tsx @@ -44,8 +44,6 @@ export default class ChatMenu extends React.Component {translate("menu.chat.title")} @@ -110,6 +108,12 @@ function ChatMessageSection(props: { filter: RegExp | null }): ReactElement { return () => GAME_MANAGER.removeStateListener(stateListener); }, [props.filter, setMessages]); + //scroll chat to bottom when filter is shut off or loaded + useEffect(() => { + if (self.current === null) return; + self.current.scrollTop = self.current.scrollHeight; + }, [props.filter]) + return
{filteredMessages.map((msg, index) => {