Closed konhi closed 2 years ago
Hi @konhi ,
I would consider the empty string as a non-empty value, and would accept a PR that adds a arg === ''
check to the line you referenced.
Since your primary issue was that the alt
and title
were showing the same value might I suggest another solutions. In cases where it does not have to strictly generate alt=""
but removing the alt
attribute entirely works as well, you could set alt
to false
rather than the empty string and it would not get rendered into your HTML at all.
Hi @JorgenEvens
I can't assign a false value to the title/alt attribute in typescript
I get the error message Type 'boolean' is not assignable to type 'string'
This has been resolved in release 5.0.3. Thanks for the PR @ritchiejacobs !
Thank you for this great library. I'm happy to use it in my project! I stumbled upon one little imperfection.
Expected behavior
<Avatar alt="" title="" name="ambassify"
-><img alt="" title="" />
Current behavior
<Avatar alt="" title="" name="ambassify"
-><img alt="ambassify" title="ambassify" />
It's because
"" == false
and it's being checked hereWhy is it bad?
It leads to repeated value which is bad for accessibility
"Ambassify" is being repeated 2 times!
Possible non-breaking solution
Add option to pass parameter which will cause in empty alt and title, e.g.
noDescription
,noAccessibility
,noAlternativeText
,noAlt
<Avatar alt="" title="" name="ambassify" noDescription
-><img alt="" title="" />