From 9ae1c05bd73dd7faa4ce3f547366a6e3c2ee463a Mon Sep 17 00:00:00 2001 From: Yury Popov Date: Tue, 12 Aug 2025 13:21:56 +0300 Subject: [PATCH 1/2] feat: remove alt prop from Avatar component --- src/components/Avatar/Avatar.tsx | 1 - .../Avatar/AvatarImage/AvatarImage.tsx | 3 +-- src/components/Avatar/AvatarImage/types.ts | 1 - src/components/Avatar/README-ru.md | 1 - src/components/Avatar/README.md | 17 ++++++++--------- .../Avatar/__stories__/Avatar.stories.tsx | 4 ---- .../__stories__/AvatarStack.stories.tsx | 1 - 7 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/components/Avatar/Avatar.tsx b/src/components/Avatar/Avatar.tsx index bd42c7d4b6..da4ebfcabf 100644 --- a/src/components/Avatar/Avatar.tsx +++ b/src/components/Avatar/Avatar.tsx @@ -34,7 +34,6 @@ export const Avatar = React.forwardRef((props, ref) fallbackImgUrl={props.fallbackImgUrl} sizes={props.sizes} srcSet={props.srcSet} - alt={props.alt || title} loading={props.loading} withImageBorder={props.withImageBorder} size={size} diff --git a/src/components/Avatar/AvatarImage/AvatarImage.tsx b/src/components/Avatar/AvatarImage/AvatarImage.tsx index ebff85ef1a..61223e39d9 100644 --- a/src/components/Avatar/AvatarImage/AvatarImage.tsx +++ b/src/components/Avatar/AvatarImage/AvatarImage.tsx @@ -11,7 +11,6 @@ export const AvatarImage = ({ fallbackImgUrl, sizes, srcSet, - alt, loading, withImageBorder, size, @@ -36,8 +35,8 @@ export const AvatarImage = ({ src={fallbackImgUrl && isErrored ? fallbackImgUrl : imgUrl} sizes={sizes} srcSet={srcSet} - alt={alt} onError={handleError} + alt="" /> ); }; diff --git a/src/components/Avatar/AvatarImage/types.ts b/src/components/Avatar/AvatarImage/types.ts index 478a221ff8..2880b733bb 100644 --- a/src/components/Avatar/AvatarImage/types.ts +++ b/src/components/Avatar/AvatarImage/types.ts @@ -5,7 +5,6 @@ export interface AvatarImageProps extends AvatarCommonProps { fallbackImgUrl?: string; sizes?: string; srcSet?: string; - alt?: string; loading?: 'eager' | 'lazy'; withImageBorder?: boolean; } diff --git a/src/components/Avatar/README-ru.md b/src/components/Avatar/README-ru.md index 047122b168..c5287c3640 100644 --- a/src/components/Avatar/README-ru.md +++ b/src/components/Avatar/README-ru.md @@ -207,7 +207,6 @@ LANDING_BLOCK--> | fallbackImgUrl | Резервное изображение, отображаемое в случае ошибки. | `string` | | | sizes | HTML-атрибут `sizes` для `img`. | `string` | | | srcSet | HTML-атрибут `srcSet` для `img`. | `string` | | -| alt | HTML-атрибут `alt` для `img`. | `string` | props.title | | loading | HTML-атрибут `loading` для `img`. | `'eager'` `'lazy'` | | | withImageBorder | Добавляет обводку по умолчанию для изображения | `boolean` | | diff --git a/src/components/Avatar/README.md b/src/components/Avatar/README.md index ea6c6d3f0c..3893deeb03 100644 --- a/src/components/Avatar/README.md +++ b/src/components/Avatar/README.md @@ -207,15 +207,14 @@ LANDING_BLOCK--> ### Image-specific -| Name | Description | Type | Default | -| :-------------- | :---------------------------------------- | :----------------: | :---------: | -| imgUrl | `img` `src` HTML attribute | `string` | | -| fallbackImgUrl | Fallback image shown if an error occurred | `string` | | -| sizes | `img` `sizes` HTML attribute | `string` | | -| srcSet | `img` `srcSet` HTML attribute | `string` | | -| alt | `img` `alt` HTML attribute | `string` | props.title | -| loading | `img` `loading` HTML attribute | `'eager'` `'lazy'` | | -| withImageBorder | Add default border for the image | `boolean` | | +| Name | Description | Type | Default | +| :-------------- | :---------------------------------------- | :----------------: | :-----: | +| imgUrl | `img` `src` HTML attribute | `string` | | +| fallbackImgUrl | Fallback image shown if an error occurred | `string` | | +| sizes | `img` `sizes` HTML attribute | `string` | | +| srcSet | `img` `srcSet` HTML attribute | `string` | | +| loading | `img` `loading` HTML attribute | `'eager'` `'lazy'` | | +| withImageBorder | Add default border for the image | `boolean` | | ### Icon-specific diff --git a/src/components/Avatar/__stories__/Avatar.stories.tsx b/src/components/Avatar/__stories__/Avatar.stories.tsx index 07a54ffe87..541d89b146 100644 --- a/src/components/Avatar/__stories__/Avatar.stories.tsx +++ b/src/components/Avatar/__stories__/Avatar.stories.tsx @@ -54,7 +54,6 @@ const randomAvatars = faker.helpers const imageProps = { imgUrl, - alt: 'Sample image', }; const iconProps = { @@ -83,7 +82,6 @@ export const Image: Story = { args: { imgUrl, 'aria-label': 'Sample avatar', - alt: 'Generated avatar', }, }; @@ -102,7 +100,6 @@ export const ImageSrcSet: StoryFunc = (args) => { ImageSrcSet.args = { imgUrl: faker.image.urlLoremFlickr({category: 'cats'}), size: 'xl', - alt: 'Image with srcset', 'aria-label': 'Random avatar', }; @@ -110,7 +107,6 @@ export const ImageFallback: Story = { args: { imgUrl: 'random_link', fallbackImgUrl: imgUrl, - alt: 'Fallbacked image', 'aria-label': 'Fallback demonstration', }, }; diff --git a/src/components/AvatarStack/__stories__/AvatarStack.stories.tsx b/src/components/AvatarStack/__stories__/AvatarStack.stories.tsx index 5cf7fd8182..746f32a225 100644 --- a/src/components/AvatarStack/__stories__/AvatarStack.stories.tsx +++ b/src/components/AvatarStack/__stories__/AvatarStack.stories.tsx @@ -33,7 +33,6 @@ function getChildren({ size={avatarSize} borderColor={'var(--g-color-line-generic-solid)'} aria-label={'For tests'} - alt={'For tests'} /> ), count, From 3debdc70577181fb5d95b6eb4d1fb024fb0064c7 Mon Sep 17 00:00:00 2001 From: Yury Popov Date: Tue, 12 Aug 2025 13:26:30 +0300 Subject: [PATCH 2/2] fix: typecheck --- .../components/ListItemView/__stories__/ListItemView.stories.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/useList/components/ListItemView/__stories__/ListItemView.stories.tsx b/src/components/useList/components/ListItemView/__stories__/ListItemView.stories.tsx index a07b860ccb..50ee127a8e 100644 --- a/src/components/useList/components/ListItemView/__stories__/ListItemView.stories.tsx +++ b/src/components/useList/components/ListItemView/__stories__/ListItemView.stories.tsx @@ -42,7 +42,6 @@ const StartSlot = ({selfStart}: {selfStart?: boolean}) => (