Show who reacted in aria-label of reactions
This commit is contained in:
parent
4131234b78
commit
21f5ac30f2
2 changed files with 41 additions and 6 deletions
|
@ -5070,6 +5070,18 @@
|
||||||
"messageformat": "Cancel",
|
"messageformat": "Cancel",
|
||||||
"description": "Appears on the cancel button in confirmation dialogs."
|
"description": "Appears on the cancel button in confirmation dialogs."
|
||||||
},
|
},
|
||||||
|
"icu:Message__reaction-emoji-label--you": {
|
||||||
|
"messageformat": "You reacted with {emoji}",
|
||||||
|
"description": "aria-label for reaction emoji (you)"
|
||||||
|
},
|
||||||
|
"icu:Message__reaction-emoji-label--single": {
|
||||||
|
"messageformat": "{title} reacted with {emoji}",
|
||||||
|
"description": "aria-label for reaction emoji when one person reacts with an emoji"
|
||||||
|
},
|
||||||
|
"icu:Message__reaction-emoji-label--many": {
|
||||||
|
"messageformat": "{count} people reacted with {emoji}",
|
||||||
|
"description": "Used as an aria-label for when many people react to a message. Count is always greater than 1"
|
||||||
|
},
|
||||||
"icu:Message__role-description": {
|
"icu:Message__role-description": {
|
||||||
"messageformat": "Message",
|
"messageformat": "Message",
|
||||||
"description": "aria-roledescription of a message"
|
"description": "aria-roledescription of a message"
|
||||||
|
@ -10475,7 +10487,7 @@
|
||||||
"description": "Title for the avatar picker in the group creation flow"
|
"description": "Title for the avatar picker in the group creation flow"
|
||||||
},
|
},
|
||||||
"icu:Preferences__message-audio-title": {
|
"icu:Preferences__message-audio-title": {
|
||||||
"messageformat": "In-chat message sound",
|
"messageformat": "In-chat message sounds",
|
||||||
"description": "Title for message audio setting"
|
"description": "Title for message audio setting"
|
||||||
},
|
},
|
||||||
"icu:Preferences__message-audio-description": {
|
"icu:Preferences__message-audio-description": {
|
||||||
|
|
|
@ -2107,11 +2107,33 @@ export class Message extends React.PureComponent<Props, State> {
|
||||||
['desc', 'desc']
|
['desc', 'desc']
|
||||||
);
|
);
|
||||||
// Take the first three groups for rendering
|
// Take the first three groups for rendering
|
||||||
const toRender = take(ordered, 3).map(res => ({
|
const toRender = take(ordered, 3).map(res => {
|
||||||
emoji: res[0].emoji,
|
const isMe = res.some(re => Boolean(re.from.isMe));
|
||||||
count: res.length,
|
const count = res.length;
|
||||||
isMe: res.some(re => Boolean(re.from.isMe)),
|
const { emoji } = res[0];
|
||||||
}));
|
|
||||||
|
let label: string;
|
||||||
|
if (isMe) {
|
||||||
|
label = i18n('icu:Message__reaction-emoji-label--you', { emoji });
|
||||||
|
} else if (count === 1) {
|
||||||
|
label = i18n('icu:Message__reaction-emoji-label--single', {
|
||||||
|
title: res[0].from.title,
|
||||||
|
emoji,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
label = i18n('icu:Message__reaction-emoji-label--many', {
|
||||||
|
count,
|
||||||
|
emoji,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
count,
|
||||||
|
emoji,
|
||||||
|
isMe,
|
||||||
|
label,
|
||||||
|
};
|
||||||
|
});
|
||||||
const someNotRendered = ordered.length > 3;
|
const someNotRendered = ordered.length > 3;
|
||||||
// We only drop two here because the third emoji would be replaced by the
|
// We only drop two here because the third emoji would be replaced by the
|
||||||
// more button
|
// more button
|
||||||
|
@ -2154,6 +2176,7 @@ export class Message extends React.PureComponent<Props, State> {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
|
aria-label={re.label}
|
||||||
type="button"
|
type="button"
|
||||||
// eslint-disable-next-line react/no-array-index-key
|
// eslint-disable-next-line react/no-array-index-key
|
||||||
key={`${re.emoji}-${i}`}
|
key={`${re.emoji}-${i}`}
|
||||||
|
|
Loading…
Add table
Reference in a new issue