alt text generated from filename can be harmful for screen reader users #30096
👋 Hi Rails friends! Here's something that's been on my mind, hopefully helpful for improving Rails accessibility support:
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
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.
Next best solution would be an application level configuration options to set filename autogeneration.
The text was updated successfully, but these errors were encountered:
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 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?
- 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]