gravity-ui / uikit

https://gravity-ui.com
MIT License
608 stars 90 forks source link

Not possible to set `alt=""` for Avatar #1599

Open ogonkov opened 5 months ago

ogonkov commented 5 months ago

I can't set alt to empty string, because it trying to fallback to title

https://github.com/gravity-ui/uikit/blob/733c5b3bd425ee57d660ed176d15bc99084f6d9a/src/components/Avatar/Avatar.tsx#L43

amje commented 5 months ago

@ogonkov Images with empty strings in alt attribute are not accessible. Why you want it?

ogonkov commented 5 months ago

It has presentation role, this is valid usage

amje commented 5 months ago

It has presentation role, this is valid usage

Has it? We don't allow set this prop

ogonkov commented 5 months ago

Yes. In some cases you don't want to expose image to a11y technologies.

In case of avatar this could be the case when it followed by user name, for example and setting alt text for avatar is obsolete.

amje commented 4 months ago

@ogonkov We decided to remove alt prop entirely from the component props