-
-
Notifications
You must be signed in to change notification settings - Fork 630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Accessibility Improvement / Tooltip Support #477
Comments
@veeru153 Thanks for opening. |
Thank you for the quick response. No this does not work. After some devtooling, the reason seems to be that when we add a
In order to render the tooltip, the text should be a Title element nested inside the SVG element like this:
|
@veeru153 Allrighty I get it. Also read some more about it. It is also good to increase accessibility. My proposal to accomplish this, is that we make it possible to pass children in icons. That creates also new possibilities to render something "over" the icon. This also keeps it really flexible and easy to implement. Example title and description<Icon>
<title>My awesome text</title>
<desc>More detailed description about the icon</desc>
</Icon> Example rendering something over the icon, for example amount of items.<ShoppingCart>
<text>5</text>
</ShoppingCart> |
Ooh yes! While this is different from the traditional image <Book>
<Code />
</Book> |
@veeru153 Yess correct! |
Wanted to release this feature, but with a final test it doesn't work as expected. Here a test environment: TLDR: |
So there is currently no way to make the icons accessible to screen readers? |
It's actually possible by using the aria attributes. For example, you can use aria-label instead of alt or for decorative icons you can use aria-hidden. But I would still prefer to set the alt attribute. |
@tommy4st Can you share the aria-label solution you mentionned? I just came from reading this article and they don't seem to mention aria-label as an option. They mostly refer to title, desc, aria-labelledby, and role="image". I'm currious if you tested it with screen-readers? @ericfennis I'm a bit confused about that statement:
Currently if we pass a <title> child to an icon it gets added after the svg markup. This causes problem with screen-readers? I'm also having doubts about supporting this through children. I'm not finding a reason why <title> couldn't just be included in the svgs by default. I'm thing that if you're concerned about users wanting to overwrite it, a custom title prop could be added. Of course if there's not enough bandwith on your side currently, any workaround / intermediary solution would be much appreciated! Thanks. |
I shifted to Lucide from Feather after having no way to add tooltips directly. A similar issue (feathericons/react-feather#67) exists for Feather which references this project but I didn't see any request or any implementation here yet. The gist of this issue/request is the ability to add alternative text like this:
<Icon alt="Navigate to Report" />
This would allow browsers to display a tooltip when you hover the cursor over the icon like this:
The linked issue goes into more detail. The icons work really well as buttons and this addition could improve the accessibility of the websites using these icons directly.
The text was updated successfully, but these errors were encountered: