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

Commit 90ea6c4

Browse files
committed
Give speecial aria-label to the DIV
1 parent 96772fb commit 90ea6c4

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/components/views/avatars/MemberAvatar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function MemberAvatar(
103103
}
104104
: props.onClick
105105
}
106-
aria-label={name ? name + ". " : ""} // Full stop adds a pause between the name and the appended message.
106+
aria-label={name ?? ""}
107107
altText={_t("common|user_avatar")}
108108
ref={ref}
109109
/>

src/components/views/rooms/EventTile.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,18 @@ export class UnwrappedEventTile extends React.Component<EventTileProps, IState>
10641064
<div
10651065
className="mx_EventTile_avatar"
10661066
id={"mx_EventTile_avatar_" + this.props.mxEvent.getId()}
1067+
role="img"
10671068
tabIndex={-1}
1069+
/**
1070+
* The accessible name of this DIV (which is the aria-label) is used within
1071+
* aria-labelledby in the li elements rendered below.
1072+
*
1073+
* The accessible name of the li element would thus be computed as name + message.
1074+
*
1075+
* We append a dot to the name so that screen readers pause after reading out the
1076+
* name i.e it reads out name + <pause> + message.
1077+
*/
1078+
aria-label={member?.name ? member.name + ". " : ""}
10681079
>
10691080
<MemberAvatar
10701081
member={member}

0 commit comments

Comments
 (0)