kiwicom/orbit

CountryFlag missing HTML attributes, like alt

RobinCsl opened this issue Β· 1 comments

Hi πŸ‘‹

It seems that the following code only allows the attributes class, src and srcset to "survive" in the actual rendered DOM image node for the CountryFlag component. In particular, the alt attribute is missing, which is not great accessibility-wise.

Could it be that the return statement should also return the other props passed to StyledImage?

Thanks a lot :)

vepor commented

Hi @RobinCsl πŸ‘‹

Even though that the use of attrs on the component only returns src and srcset, passing of alt in the JSX is still allowed and it will be rendered in the DOM.

By default, it’s not there, as name is null. But if you pass any, it will be rendered. You can see this on Playground story of CountryFlag.