diff --git a/.changelog/5916-fix-roledescription-l10n.md b/.changelog/5916-fix-roledescription-l10n.md new file mode 100644 index 0000000000..3cae4169cd --- /dev/null +++ b/.changelog/5916-fix-roledescription-l10n.md @@ -0,0 +1,3 @@ +### Fixed + +- Fixed the "message" and "attachment" role descriptions being hard-coded in English, in PR [#5916](https://github.com/microsoft/BotFramework-WebChat/pull/5916), by [@OEvgeny](https://github.com/OEvgeny) diff --git a/__tests__/html2/accessibility/aria-roledescription.localized.html b/__tests__/html2/accessibility/aria-roledescription.localized.html new file mode 100644 index 0000000000..c610a57080 --- /dev/null +++ b/__tests__/html2/accessibility/aria-roledescription.localized.html @@ -0,0 +1,124 @@ + + +
+ + + + + + + + + + diff --git a/__tests__/html2/accessibility/aria-roledescription.localized.html.snap-1.png b/__tests__/html2/accessibility/aria-roledescription.localized.html.snap-1.png new file mode 100644 index 0000000000..752884be7d Binary files /dev/null and b/__tests__/html2/accessibility/aria-roledescription.localized.html.snap-1.png differ diff --git a/__tests__/html2/accessibility/aria-roledescription.localized.html.snap-2.png b/__tests__/html2/accessibility/aria-roledescription.localized.html.snap-2.png new file mode 100644 index 0000000000..5c12030c87 Binary files /dev/null and b/__tests__/html2/accessibility/aria-roledescription.localized.html.snap-2.png differ diff --git a/packages/api/src/localization/en-US.json b/packages/api/src/localization/en-US.json index de235be977..9084114082 100644 --- a/packages/api/src/localization/en-US.json +++ b/packages/api/src/localization/en-US.json @@ -12,6 +12,10 @@ "_ACTIVITY_YOU_SAID_ALT.comment": "This is for screen reader only.", "ACTIVITY_BOT_ATTACHED_ALT": "Bot attached:", "_ACTIVITY_BOT_ATTACHED_ALT.comment": "This is for screen reader and is narrated before each attachments sent by the bot.", + "ACTIVITY_ATTACHMENT_ARIA_ROLE_ALT": "attachment", + "_ACTIVITY_ATTACHMENT_ARIA_ROLE_ALT.comment": "This is for screen reader for the aria-roledescription of each attachment in a message, narrated as the type of the element.", + "ACTIVITY_MESSAGE_ARIA_ROLE_ALT": "message", + "_ACTIVITY_MESSAGE_ARIA_ROLE_ALT.comment": "This is for screen reader for the aria-roledescription of the text of a message, narrated as the type of the element.", "ACTIVITY_CODE_ALT": "Code sample: $1", "_ACTIVITY_CODE_ALT.comment": "This is for screen reader code sample dialog label, $1 is the dialog title.", "ACTIVITY_CONTENT_CAUTION": "AI-generated content may be incorrect", diff --git a/packages/component/src/Activity/AttachmentRow.tsx b/packages/component/src/Activity/AttachmentRow.tsx index 5200185893..860bc287f6 100644 --- a/packages/component/src/Activity/AttachmentRow.tsx +++ b/packages/component/src/Activity/AttachmentRow.tsx @@ -1,14 +1,17 @@ -import { reactNode, validateProps } from '@msinternal/botframework-webchat-react-valibot'; +import { reactNode, validateProps, type InferReactProps } from '@msinternal/botframework-webchat-react-valibot'; import { useStyles } from '@msinternal/botframework-webchat-styles/react'; +import { hooks } from 'botframework-webchat-api'; import cx from 'classnames'; import React, { memo } from 'react'; -import { boolean, object, optional, pipe, readonly, string, type InferInput } from 'valibot'; +import { boolean, object, optional, pipe, readonly, string } from 'valibot'; import ScreenReaderText from '../ScreenReaderText'; import Bubble from './Bubble'; import styles from './StackedLayout.module.css'; +const { useLocalizer } = hooks; + const attachmentRowPropsSchema = pipe( object({ attachedAlt: string(), @@ -21,7 +24,7 @@ const attachmentRowPropsSchema = pipe( readonly() ); -type AttachmentRowProps = InferInput