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
Improve img alt attribute for screen readers #9221
Improve img alt attribute for screen readers #9221
Conversation
| tough on accessibility, because Apple's VoiceOver Utility pronounces | ||
| each underscore. When a filename is hypenated, the hyphens remain: | ||
| `<img alt="A-long-file-name-with-hyphens`. This isn't as bad as the | ||
| underscores because the hypens aren't pronounced in VoiceOver, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hyphens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it's bad also. Look here
Do not make sense mentionioning Apple's Voice Over Utility, because before of that the alt definition is violated by the current implementation
|
It's a completely backward incompatible change unfortunately, but I agree that underscores doesn't seem good in alt attribute, it always bothered me. Thanks. |
|
Awesome. Even though it's not backwards compatible, nobody should be relying on |
|
@carlosantoniodasilva, thanks for the suggestions (and catching the typos). Should I add example output to the changelog and the documentation on the method itself, or just in the changelog? |
|
@carlosantoniodasilva I added some clearer documentation and some examples. Check it out. |
|
About the changelog.
|
|
I'm not sure why you would say that mentioning Voice Over is "wrong", @acapilleri. The reason I mention it is that it's a screen reader, and that screen readers for the vision impaired are, I would argue, the primary use case for the The definition, as you state it, is mostly correct, but incomplete. As noted in the (SitePoint Reference)(http://reference.sitepoint.com/html/img/alt),
456 Berea St also has a good write up on the alt tag and its use in screen readers. And the W3 specification mentions other use cases, primarily focused on accessibility, not instances where the image won't load:
Thus, screen readers are my primary concern, as noted in the pull request title, because I think accessibility is important. So the reason I mention Voice Over is twofold:
Further, I didn't need to test it in any other screen readers because it was broken on Apple computers, a significant enough portion of the market that, even if this worked on every other screen reader, it would still need fixing for Apple's Voice Over. Lastly, in the other use cases that you correctly point out, if the image doesn't display, the text should describe the image, and a long, hyphenated and capitalized string doesn't work well for that case, either. So whatever the reason that an |
|
Can you squash please? |
Currently, the img_alt method in ActionView keeps underscores in the alt attribute. Because underscores are pronounced in Apple's VoiceOver Utility, this has serious implications for accessibility. This patch makes underscored or hyphenated file names (both common in projects) read more naturally in screen readers by replacing them with spaces. See method documentation for details. Added documentation to image_alt method
|
Squashed. Please let me know if there's anything else you'd like to see happen on this. |
|
Looks great. |
Improve img alt attribute for screen readers
|
Thanks! |
Currently, the img_alt method in ActionView maintains underscores
in the alt attribute. Because underscores are pronounced in
Apple's VoiceOver Utility, this has serious implications for
accessibility. This patch makes underscored or hyphenated file
names (both common in projects) read more naturally in screen
readers.