@@ -24,10 +24,11 @@ const { useAvatarForBot, useAvatarForUser, useLocalizer, useStyleOptions } = hoo
2424
2525type StackedLayoutInnerProps = Readonly < {
2626 activity : WebChatActivity ;
27- hasDisplayText : boolean ;
28- hasAttachments : boolean ;
2927 children ?: ReactNode | undefined ;
3028 fromUser : boolean ;
29+ hasAttachments : boolean ;
30+ hasDisplayText : boolean ;
31+ id : string ;
3132 renderAvatar ?: false | ( ( ) => Exclude < ReactNode , boolean | null | undefined > ) | undefined ;
3233 renderBubbleContent : ( title ?: string | undefined ) => ReactNode ;
3334 showCallout ?: boolean | undefined ;
@@ -36,18 +37,18 @@ type StackedLayoutInnerProps = Readonly<{
3637const StackedLayoutInner = memo (
3738 ( {
3839 activity,
39- hasDisplayText,
40- hasAttachments,
4140 children,
4241 fromUser,
42+ hasAttachments,
43+ hasDisplayText,
44+ id,
4345 renderAvatar,
4446 renderBubbleContent,
4547 showCallout
4648 } : StackedLayoutInnerProps ) => {
4749 const [ styleOptions ] = useStyleOptions ( ) ;
4850 const [ { initials : botInitials } ] = useAvatarForBot ( ) ;
4951 const [ { initials : userInitials } ] = useAvatarForUser ( ) ;
50- const ariaLabelId = useUniqueId ( 'webchat__stacked-layout__main' ) ;
5152 const localize = useLocalizer ( ) ;
5253 const classNames = useStyles ( styles ) ;
5354
@@ -80,7 +81,7 @@ const StackedLayoutInner = memo(
8081 className = { cx ( classNames [ 'stacked-layout__message-row' ] ) }
8182 // Disable "Prop `id` is forbidden on DOM Nodes" rule because we are using the ID prop for accessibility.
8283 /* eslint-disable-next-line react/forbid-dom-props */
83- id = { ariaLabelId }
84+ id = { id }
8485 role = "group"
8586 >
8687 < ScreenReaderText text = { greetingAlt } />
@@ -281,6 +282,7 @@ const StackedLayout = ({
281282 fromUser = { fromUser }
282283 hasAttachments = { attachmentChildren . length > 0 }
283284 hasDisplayText = { ! ! activityDisplayText ?. length || isCollapsible }
285+ id = { ariaLabelId }
284286 renderAvatar = { renderAvatar }
285287 renderBubbleContent = { renderBubbleContent }
286288 showCallout = { showCallout }
0 commit comments