From 00c714265b3aa41c8c21e21b90b8c6c87009d2b8 Mon Sep 17 00:00:00 2001 From: Joshua Irmer Date: Tue, 25 Feb 2025 15:59:45 +0100 Subject: [PATCH] fix(chat): restructure chat messages Signed-off-by: Joshua Irmer --- .../base/react/components/web/Message.tsx | 17 ++++++++-- .../chat/components/web/ChatMessage.tsx | 33 ++++++++++--------- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/react/features/base/react/components/web/Message.tsx b/react/features/base/react/components/web/Message.tsx index ec56a9143e29..23062f994e5c 100644 --- a/react/features/base/react/components/web/Message.tsx +++ b/react/features/base/react/components/web/Message.tsx @@ -15,6 +15,11 @@ interface IProps { */ gifEnabled: boolean; + /** + * Message decoration for screen reader. + */ + screenReaderHelpText?: string; + /** * The body of the message. */ @@ -91,10 +96,18 @@ class Message extends Component { * @returns {ReactElement} */ render() { + const { screenReaderHelpText } = this.props; + return ( - <> +

+ { screenReaderHelpText && ( + + {screenReaderHelpText} + + ) } + { this._processMessage() } - +

); } } diff --git a/react/features/chat/components/web/ChatMessage.tsx b/react/features/chat/components/web/ChatMessage.tsx index 5d412c69bf79..12ac5ad6c98c 100644 --- a/react/features/chat/components/web/ChatMessage.tsx +++ b/react/features/chat/components/web/ChatMessage.tsx @@ -254,7 +254,9 @@ const ChatMessage = ({ function _renderTimestamp() { return (
- {getFormattedTimestamp(message)} +

+ {getFormattedTimestamp(message)} +

); } @@ -285,15 +287,17 @@ const ChatMessage = ({
- {reaction} - {participants.size} +

+ {reaction} + {participants.size} +

{Array.from(participants).map(participantId => ( -
{state && getParticipantDisplayName(state, participantId)} -
+

))}
@@ -311,12 +315,12 @@ const ChatMessage = ({ visible = { isReactionsOpen }>
{reactionsArray.slice(0, numReactionsDisplayed).map(({ reaction }, index) => - {reaction} +

{reaction}

)} {reactionsArray.length > numReactionsDisplayed && ( - +

+{totalReactions - numReactionsDisplayed} - +

)}
@@ -352,14 +356,13 @@ const ChatMessage = ({
{showDisplayName && _renderDisplayName()}
- - {message.displayName === message.recipient - ? t('chat.messageAccessibleTitleMe') - : t('chat.messageAccessibleTitle', { + ('chat.messageAccessibleTitleMe') + : t('chat.messageAccessibleTitle', { user: message.displayName - })} - - + }) } + text = { getMessageText(message) } /> {(message.privateMessage || (message.lobbyChat && !knocking)) && _renderPrivateNotice()}