diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ea94b2678..327c689707 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,7 @@ Legends: - Fixed screen readers announcing a single audio, video, or animation in a card as a list item, such as "1 of 1", fixes [#5722](https://github.com/microsoft/BotFramework-WebChat/issues/5722), in PR [#5903](https://github.com/microsoft/BotFramework-WebChat/pull/5903), by [@OEvgeny](https://github.com/OEvgeny) - Fixed video and animation cards disappearing in production builds when the video URL is relative or invalid, in PR [#5889](https://github.com/microsoft/BotFramework-WebChat/pull/5889), by [@OEvgeny](https://github.com/OEvgeny) - Fixed timestamps always using the 12-hour clock, such as "4:41 PM" instead of "16:41" in German, in PR [#5920](https://github.com/microsoft/BotFramework-WebChat/pull/5920), by [@OEvgeny](https://github.com/OEvgeny) +- Fixed screen readers not saying "Click to interact." for messages with links, in PR [#5927](https://github.com/microsoft/BotFramework-WebChat/pull/5927), by [@OEvgeny](https://github.com/OEvgeny) ## [4.19.2] - 2026-10-08 diff --git a/__tests__/html2/accessibility/accessibleName.link.html b/__tests__/html2/accessibility/accessibleName.link.html new file mode 100644 index 0000000000..b2ad5111ea --- /dev/null +++ b/__tests__/html2/accessibility/accessibleName.link.html @@ -0,0 +1,68 @@ + + + + + + + + + +
+ + + + diff --git a/packages/component/src/Transcript/useActivityAccessibleName.ts b/packages/component/src/Transcript/useActivityAccessibleName.ts index 9e3d9d3473..017531d176 100644 --- a/packages/component/src/Transcript/useActivityAccessibleName.ts +++ b/packages/component/src/Transcript/useActivityAccessibleName.ts @@ -9,10 +9,7 @@ import tabbableElements from '../Utils/tabbableElements'; import useRenderMarkdownAsHTML from '../hooks/useRenderMarkdownAsHTML'; import useValueRef from '../hooks/internal/useValueRef'; -enum InteractiveType { - LINK, - WIDGET -} +type InteractiveType = 'link' | 'widget'; const { useAvatarForBot, useGetKeyByActivity, useLocalizer, useSendStatusByActivityKey } = hooks; @@ -84,9 +81,9 @@ export default function useActivityAccessibleName(activity: WebChatActivity, bod messageTextAlt, numAttachmentsAlt, isSendFailed ? activityInteractiveReasonSendFailedAlt : '', - interactiveType === InteractiveType.LINK + interactiveType === 'link' ? activityInteractiveReasonLinkAlt - : interactiveType === InteractiveType.WIDGET + : interactiveType === 'widget' ? activityInteractiveReasonInteractiveContentAlt : '', interactiveType || isSendFailed ? activityInteractiveFootNoteAlt : '' @@ -110,8 +107,7 @@ export default function useActivityAccessibleName(activity: WebChatActivity, bod const hasLinks = !!bodyRef.current?.querySelector('a'); const hasWidgets = !!tabbableElements(bodyRef.current).length; - interactiveTypeRef.current !== hasWidgets && - setInteractiveType(hasLinks ? InteractiveType.LINK : hasWidgets ? InteractiveType.WIDGET : false); + interactiveTypeRef.current !== hasWidgets && setInteractiveType(hasLinks ? 'link' : hasWidgets ? 'widget' : false); }, [bodyRef, interactiveTypeRef, setInteractiveType]); return [accessibleName];