Skip to content

Commit 68dfd12

Browse files
authored
[Chat] Fix Issue where screen reader announces "&nbsp" (#4500)
1 parent 2865080 commit 68dfd12

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "Inline Image",
5+
"comment": "Fixed Screen Reader Reads ` `",
6+
"packageName": "@azure/communication-react",
7+
"email": "[email protected]",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "Inline Image",
5+
"comment": "Fixed Screen Reader Reads ` `",
6+
"packageName": "@azure/communication-react",
7+
"email": "[email protected]",
8+
"dependentChangeType": "patch"
9+
}

packages/react-components/src/components/ChatMessage/ChatMessageContent.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,13 @@ const extractContentForAllyMessage = (props: ChatMessageContentProps): string =>
186186
parsedContent.replaceChild(imageTextNode, child);
187187
});
188188

189-
// Inject attachment names for aria.
190-
if (attachments) {
191-
let attachmentList = '';
192-
/* @conditional-compile-remove(attachment-download) */
193-
attachmentList = attachmentCardGroupDescription(props);
189+
// Inject message attachment count for aria.
190+
// this is only applying to file attachments not for inline images.
191+
/* @conditional-compile-remove(attachment-download) */
192+
if (attachments && attachments.length > 0) {
193+
const attachmentCardDescription = attachmentCardGroupDescription(props);
194194
const attachmentTextNode = document.createElement('div');
195-
attachmentTextNode.innerHTML = ` ${attachmentList} `;
195+
attachmentTextNode.innerHTML = `${attachmentCardDescription}`;
196196
parsedContent.appendChild(attachmentTextNode);
197197
}
198198

0 commit comments

Comments
 (0)