Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Give speecial aria-label to the DIV
Browse files Browse the repository at this point in the history
  • Loading branch information
MidhunSureshR committed May 20, 2024
1 parent 96772fb commit 90ea6c4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/views/avatars/MemberAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function MemberAvatar(
}
: props.onClick
}
aria-label={name ? name + ". " : ""} // Full stop adds a pause between the name and the appended message.
aria-label={name ?? ""}
altText={_t("common|user_avatar")}
ref={ref}
/>
Expand Down
11 changes: 11 additions & 0 deletions src/components/views/rooms/EventTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,18 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
<div
className="mx_EventTile_avatar"
id={"mx_EventTile_avatar_" + this.props.mxEvent.getId()}
role="img"
tabIndex={-1}
/**
* The accessible name of this DIV (which is the aria-label) is used within
* aria-labelledby in the li elements rendered below.
*
* The accessible name of the li element would thus be computed as name + message.
*
* We append a dot to the name so that screen readers pause after reading out the
* name i.e it reads out name + <pause> + message.
*/
aria-label={member?.name ? member.name + ". " : ""}
>
<MemberAvatar
member={member}
Expand Down

0 comments on commit 90ea6c4

Please sign in to comment.