mirror of
https://github.com/mattermost/mattermost.git
synced 2026-09-24 16:05:00 +08:00
MM-62978 Remove alt text from profile picture in File Preview modal (#33584)
* MM-62978 Remove alt text from profile picture in File Preview modal * Update snapshots
This commit is contained in:
+1
@@ -5,6 +5,7 @@ exports[`components/FilePreviewModalInfo should match snapshot 1`] = `
|
||||
className="file-preview-modal__info"
|
||||
>
|
||||
<Memo(Avatar)
|
||||
alt=""
|
||||
className="file-preview-modal__avatar"
|
||||
size="lg"
|
||||
url="/api/v4/users/user_id/image?_=0"
|
||||
|
||||
+1
@@ -79,6 +79,7 @@ const FilePreviewModalInfo: React.FC<Props> = (props: Props) => {
|
||||
username={user?.username}
|
||||
url={imageURLForUser(props.post.user_id, user?.last_picture_update)}
|
||||
className='file-preview-modal__avatar'
|
||||
alt=''
|
||||
/>
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,14 @@ type Props = {
|
||||
username?: string;
|
||||
size?: TAvatarSizeToken;
|
||||
text?: string;
|
||||
|
||||
/**
|
||||
* Override the default alt text for the image.
|
||||
*
|
||||
* If this Avatar is accompanied in the DOM by the user's name, this should be set to the empty string to prevent
|
||||
* screen readers from repeating the user's name multiple times.
|
||||
*/
|
||||
alt?: string;
|
||||
};
|
||||
|
||||
type Attrs = HTMLAttributes<HTMLElement>;
|
||||
@@ -55,6 +63,7 @@ const Avatar = forwardRef<HTMLElement, Props & Attrs>(({
|
||||
username,
|
||||
size = 'md',
|
||||
text,
|
||||
alt,
|
||||
...attrs
|
||||
}, ref) => {
|
||||
const {formatMessage} = useIntl();
|
||||
@@ -85,7 +94,7 @@ const Avatar = forwardRef<HTMLElement, Props & Attrs>(({
|
||||
{...attrs}
|
||||
ref={ref as RefObject<HTMLImageElement>}
|
||||
className={classes}
|
||||
alt={formatMessage({id: 'avatar.alt', defaultMessage: '{username} profile image'}, {
|
||||
alt={alt ?? formatMessage({id: 'avatar.alt', defaultMessage: '{username} profile image'}, {
|
||||
username: username || 'user',
|
||||
})}
|
||||
src={url}
|
||||
|
||||
Reference in New Issue
Block a user