Skip to content

Commit

Permalink
Replace left pane button aria-label
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-signal committed Apr 21, 2023
1 parent 5d42997 commit 0bf351b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
21 changes: 9 additions & 12 deletions ts/components/ConversationList.tsx
Expand Up @@ -373,24 +373,21 @@ export function ConversationList({
]);
const { badges, title, unreadCount, lastMessage } = itemProps;
result = (
<div
aria-label={i18n('icu:ConversationList__aria-label', {
<ConversationListItem
{...itemProps}
buttonAriaLabel={i18n('icu:ConversationList__aria-label', {
lastMessage:
get(lastMessage, 'text') ||
i18n('icu:ConversationList__last-message-undefined'),
title,
unreadCount,
})}
>
<ConversationListItem
{...itemProps}
key={key}
badge={getPreferredBadge(badges)}
onClick={onSelectConversation}
i18n={i18n}
theme={theme}
/>
</div>
key={key}
badge={getPreferredBadge(badges)}
onClick={onSelectConversation}
i18n={i18n}
theme={theme}
/>
);
break;
}
Expand Down
11 changes: 8 additions & 3 deletions ts/components/conversationList/BaseConversationListItem.tsx
Expand Up @@ -33,6 +33,7 @@ const CHECKBOX_CLASS_NAME = `${BASE_CLASS_NAME}__checkbox`;
export const SPINNER_CLASS_NAME = `${BASE_CLASS_NAME}__spinner`;

type PropsType = {
buttonAriaLabel?: string;
checked?: boolean;
conversationType: 'group' | 'direct';
disabled?: boolean;
Expand Down Expand Up @@ -79,6 +80,7 @@ export const BaseConversationListItem: FunctionComponent<PropsType> =
acceptedMessageRequest,
avatarPath,
avatarSize,
buttonAriaLabel,
checked,
color,
conversationType,
Expand Down Expand Up @@ -250,9 +252,12 @@ export const BaseConversationListItem: FunctionComponent<PropsType> =
if (onClick) {
return (
<button
aria-label={i18n('icu:BaseConversationListItem__aria-label', {
title,
})}
aria-label={
buttonAriaLabel ||
i18n('icu:BaseConversationListItem__aria-label', {
title,
})
}
className={classNames(
commonClassNames,
`${BASE_CLASS_NAME}--is-button`
Expand Down
3 changes: 3 additions & 0 deletions ts/components/conversationList/ConversationListItem.tsx
Expand Up @@ -68,6 +68,7 @@ export type PropsData = Pick<
};

type PropsHousekeeping = {
buttonAriaLabel?: string;
i18n: LocalizerType;
onClick: (id: string) => void;
theme: ThemeType;
Expand All @@ -80,6 +81,7 @@ export const ConversationListItem: FunctionComponent<Props> = React.memo(
acceptedMessageRequest,
avatarPath,
badge,
buttonAriaLabel,
color,
draftPreview,
groupId,
Expand Down Expand Up @@ -193,6 +195,7 @@ export const ConversationListItem: FunctionComponent<Props> = React.memo(
acceptedMessageRequest={acceptedMessageRequest}
avatarPath={avatarPath}
badge={badge}
buttonAriaLabel={buttonAriaLabel}
color={color}
conversationType={type}
groupId={groupId}
Expand Down

0 comments on commit 0bf351b

Please sign in to comment.