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
Add aria-label
in addition to the alt
prop
#30
Comments
That's a good shout-out. We'll add this to the upcoming 2.0 release. Thanks @brandonleboeuf! |
Wait, it looks like this attribute is for use when the element is labeled by visible text, which is not the case with icons. Are you sure there is an accessibility concern? I am pretty sure the |
Good catch @rektdeckard ! I did mean It is needed, as the icons are currently being skipped by the screen reader, even when there is something passed via the phosphor alt prop. As a work around, I have been adding a wrapper div with the aria-label around any phosphor icon that needs to be read by the screen reader. From MDN on the title not being read by screen readers: "Text in a <title> element is not rendered as part of the graphic, but browsers usually display it as a tooltip. If an element can be described by visible text, it is recommended to reference that text with an aria-labelledby attribute rather than using the <title> element." Though, looking at aria-labelledby, it does state to use |
aria-labelledby
in addition to the alt
proparia-label
in addition to the alt
prop
aria-label
in addition to the alt
proparia-label
in addition to the alt
prop
aria-label
in addition to the alt
proparia-label
in addition to the alt
prop
aria-label
in addition to the alt
proparia-label
in addition to the alt
prop
Noted! Though, as our library docs mention, any and all valid SVG attributes you add to an icon will be applied to the rendered DOM node, so the real solution for you to just add that attribute to the icon yourself. Our <House size={32} aria-label="An icon of a house" /> This will do you right. If you want both a tooltip and |
Thank you! I think having the It would be nice to have aria-label? added to Props section of the readme.md so that it eliminates that confusion since the docs currently state that the alt prop will "add accessible alt text to an icon". |
This is good by me 👍 |
I am a bit confused by the resolution here. What is the point of the |
@benface honestly, I don't think we should have done the alt thing to begin with. I took the suggestion in #22 and the changes made in #23 to mean that this would be accessible to screen readers. And though I don't like to add needless shorthands for things that have a perfectly good idiomatic/native way to do it, I merged it anyway. It seems this was not a good assumption. The issues I see with modifying it further to add an
Shorthands for things that are already short are bad. The thing I'd consider doing is deprecating the |
Ah, I understand @rektdeckard. Good idea to deprecate it then. (I would personally like if |
@benface I'll remove it from the Would like to educate myself a bit more on the accessibility best practices here, but it seems like there are definitely some cases where icons do not need to be labeled, such as when used for decorative purposes or made redundant by control/input/button labels. Not sure if I would want to force it. |
Yes @rektdeckard you are definitely right, but I prefer making it required so the developer is forced to think about it. And, if there is no need for a label, they can do |
Browsers usually display the
<title>
as a tool tip, but for a11y, shouldn't this also have thearia-labelledbyaria-label?MDN refrence: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title
The text was updated successfully, but these errors were encountered: