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

Commit 8369256

Browse files
committed
Use custom reaction shortcode for accessibility
This uses the shortcode in the following places: * The aria-label of the reaction buttons * The alt text for the reaction image Signed-off-by: Sumner Evans <sumner@beeper.com>
1 parent 6dfc665 commit 8369256

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/components/views/messages/ReactionsRowButton.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,23 @@ export default class ReactionsRowButton extends React.PureComponent<IProps, ISta
107107

108108
const room = this.context.getRoom(mxEvent.getRoomId());
109109
let label: string | undefined;
110+
let customReactionName = "";
110111
if (room) {
111112
const senders: string[] = [];
112113
for (const reactionEvent of reactionEvents) {
113114
const member = room.getMember(reactionEvent.getSender()!);
114115
senders.push(member?.name || reactionEvent.getSender()!);
116+
if (reactionEvent.event.content?.["com.beeper.reaction.shortcode"]) {
117+
customReactionName = reactionEvent.event.content?.["com.beeper.reaction.shortcode"];
118+
}
115119
}
116120

117121
const reactors = formatCommaSeparatedList(senders, 6);
118122
if (content) {
119-
label = _t("%(reactors)s reacted with %(content)s", { reactors, content });
123+
label = _t("%(reactors)s reacted with %(content)s", {
124+
reactors,
125+
content: customReactionName || content,
126+
});
120127
} else {
121128
label = reactors;
122129
}
@@ -133,7 +140,7 @@ export default class ReactionsRowButton extends React.PureComponent<IProps, ISta
133140
reactionContent = (
134141
<img
135142
className="mx_ReactionsRowButton_content"
136-
alt={content}
143+
alt={customReactionName || content}
137144
src={imageSrc}
138145
width="16"
139146
height="16"

0 commit comments

Comments
 (0)