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
alt text generated from filename can be harmful for screen reader users #30096
Comments
Completely agree with this proposal. Working on various client sites and sifting through their image libraries, I find more often than not, that their file names are merely just the default naming strings from their phones or digital cameras. |
This is what I proposed for Drupal https://www.drupal.org/node/2307279 Ultimately you could create a means to programmatically determine if a string looks like a filename (no spaces, a period followed by 2-4 letters) and use that associated with some common blacklist words (image, alt, alt text, photo). Not that you couldn't use a filename or blacklisted word, but you couldn't just use them. Anyways, hope this gathers some support. |
Thanks for proposing this! I’m in favor of dropping the filename fallback altogether.
The cited whitepaper confirms that JAWS, the most popular screen reader for Windows, does this. |
Actually, after thinking about it more, I don’t quite understand how removing the filename fallback would help. The whitepaper you cited says that the 300% increase in readable content comes from not populating To fix the problem you’re pointing out, Rails would need to somehow enforce that |
Assistive Tech often tries to do hacky things like use the file name in the hopes that it might give the blind user more context. In generally falling back to the filename is a bad idea though. JAWS is a very configurable program and it is very likely that a user could enable or disable this. Here's the reference to the ATAG 2.0 reference: Drupal 8 is requiring alt text by default: This is a different program/community. Still, worth while reaching out to what we've done in the past for guidance. |
Thanks for the clarification. I’m in favor of removing the fallback in Rails and leaving it up to the screen reader. 😄 |
Thanks for the responses so far! Really appreciate this is getting discussion. @georgeclaghorn I have some thoughts!
I revisited the whitepaper too, I see now I didn't understand the 300% increase measurement at first glance. My first impression was that they were using empty strings as the values for the Generally though, I can say from observation and experience that filename based generated alt text is unreliable at best, and at worst and can distracting and fatiguing for people using screen readers. I can work on getting some empirical research, but I think anecdotally it stands to reason that teams are not naming images with alt text as a core motive.
This is at the core of the concern. I don't think it's Rails's job to enforce alt text at all. It'd be better to do nothing and let linters or other tooling to pick up the missing alt text. That's all to say that filename alt text generation obscures the nuances of image description that really should be up to the author to decide. I ❤️ convention over configuration, but in this case file name based text is not a sane default and might create a false sense of completeness. To the point of "completeness", this also has bearing on standards and accessibility guidelines (and laws). I don't believe that the feature was built to "check the box" for WCAG 2.0 and Section 508 requirements, but it has the side effect of doing so in a half-baked way, and so makes it harder to identify failures to apply alt text thoughtfully. That's what I had in mind when I brought up automated testing and linting. That's where I'm at right now. George, does that address your concerns? Do we think there are more ways we bring this closer to a solution? |
@georgeclaghorn I can put together a PR for this if it's something you're willing to review! |
@ckundo please |
- Auto-generating content from the filename of an image is not suitable alternative text; alt text that isn't fully considered can be distracting and fatiguing for screen readers users (blind, low vision, dyslexic people). - Setting a filename fallback short circuits screen reader default behavior and configuration for blank descriptions. - Setting poor defaults also creates false negatives for accessibility linting and testing software, that makes it harder to improve application accessibility. *** - After this change, if authors leave images without alt text, screen readers will fallback to default behavior for missing alt text. - Also with this change, Automated linting and testing tools will correctly generate warnings. [Fixes rails#30096]
👋 Hi Rails friends! Here's something that's been on my mind, hopefully helpful for improving Rails accessibility support:
Autogenerated
alt
text based on filename creates naïve descriptions that can do more harm than good. The content generated by automatically adding alt text can lead to a 300% increase in reading content, creating fatigue for screen reader users. If the content is not useful, this is a waste.Autogenerated alt text also creates false negatives for linting tools that look for images that need descriptions.
If I'm adding a logo to a header in a document, I may use the
image_tag
helper.That renders:
The alt text "Logo" will be announced to screen reader users (blind, low vision, and sometime dyslexic folk). "Logo" is not a useful description and adds unnecessary content.
This whitepaper on alt text by TPG suggests that filenames as alt text are often useless.
Expected behavior
Logos
In the
logo.png
example, the alt text should read the company name. There might be heuristics to automate that, but even in this simple case it's likely easier and more robust to rely on the author.http://webaim.org/techniques/alttext/#logos
image_tag
ideally would not add automatically generatedalt
text. The behavior for screen reader users would not change much, since most screen reader tech falls back on filename with no alt text is present anyways. It may cause automated testing an linters to fail since no alt attribute is added. These failures would arguably be correct.Next best solution would be an application level configuration options to set filename autogeneration.
System configuration
Rails version:
Rails 5.1.3
Ruby version:
ruby 2.4.1
The text was updated successfully, but these errors were encountered: