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

Do not generate default alt text for images #30213

Merged
merged 1 commit into from Aug 23, 2017

Conversation

Projects
None yet
7 participants
@ckundo
Contributor

ckundo commented Aug 12, 2017

Summary

  • Deprecate image_alt helper.
  • Remove the call to image_alt from image_tag.

[Fixes #30096]

Impact

  • After this change, screen readers will fallback to default, expected, and user configurable behavior for missing alt text.
  • Also with this change, automated linting and testing tools will correctly generate warnings.

Motivation

  • 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, and may be frustrating to the assistive technology user.
  • Setting poor defaults also creates false negatives for linting tools, that makes it harder to improve application accessibility.
@rails-bot

This comment has been minimized.

Show comment
Hide comment
@rails-bot

rails-bot Aug 12, 2017

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @schneems (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

rails-bot commented Aug 12, 2017

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @schneems (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

@ckundo

This comment has been minimized.

Show comment
Hide comment
@ckundo

ckundo Aug 12, 2017

Contributor

I'm working on fixing up test failures now, but the gist of the PR is the same.

Contributor

ckundo commented Aug 12, 2017

I'm working on fixing up test failures now, but the gist of the PR is the same.

@ckundo

This comment has been minimized.

Show comment
Hide comment
@ckundo

ckundo Aug 12, 2017

Contributor

Something to reiterate from the PR comment: this change will create warnings in some accessibility testing tools. These would be correct failures, but new failures nonetheless. In some cases these warnings could potentially be part of CI suites, and, in an even more narrow subset of applications, may create build failures.

Is it worth introducing a configuration option to disable the correct behavior for folks that may need to fix failures when upgrading Rails? The alternative for those that want to delay fixes would be to monkey-patch the image_tag helper in their apps until they remediate the issue. @mgifford how did y'all handle this in Drupal?

Contributor

ckundo commented Aug 12, 2017

Something to reiterate from the PR comment: this change will create warnings in some accessibility testing tools. These would be correct failures, but new failures nonetheless. In some cases these warnings could potentially be part of CI suites, and, in an even more narrow subset of applications, may create build failures.

Is it worth introducing a configuration option to disable the correct behavior for folks that may need to fix failures when upgrading Rails? The alternative for those that want to delay fixes would be to monkey-patch the image_tag helper in their apps until they remediate the issue. @mgifford how did y'all handle this in Drupal?

@rafaelfranca

It looks good to me. Nice work. Can you add a CHANGELOG entry?

Show outdated Hide outdated actionview/lib/action_view/helpers/asset_tag_helper.rb
Show outdated Hide outdated actionview/lib/action_view/helpers/asset_tag_helper.rb
Show outdated Hide outdated actionview/lib/action_view/helpers/asset_tag_helper.rb
Show outdated Hide outdated actionview/lib/action_view/helpers/asset_tag_helper.rb
@rafaelfranca

Looks good to me. Can you squash your commits?

Show outdated Hide outdated actionview/lib/action_view/helpers/asset_tag_helper.rb
Show outdated Hide outdated actionview/CHANGELOG.md
@ckundo

This comment has been minimized.

Show comment
Hide comment
@ckundo

ckundo Aug 17, 2017

Contributor

Thanks @maclover7, fixed. Good to squash?

Contributor

ckundo commented Aug 17, 2017

Thanks @maclover7, fixed. Good to squash?

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca

rafaelfranca Aug 17, 2017

Member

👍 squash again

Member

rafaelfranca commented Aug 17, 2017

👍 squash again

Do not generate default alt text in image tags
- 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 #30096]
@ckundo

This comment has been minimized.

Show comment
Hide comment
@ckundo

ckundo Aug 21, 2017

Contributor

Squashed and ready!

Contributor

ckundo commented Aug 21, 2017

Squashed and ready!

@ckundo

This comment has been minimized.

Show comment
Hide comment
@ckundo

ckundo Aug 23, 2017

Contributor

@rafaelfranca anything else I can add?

Contributor

ckundo commented Aug 23, 2017

@rafaelfranca anything else I can add?

@rafaelfranca rafaelfranca merged commit 9a74c7b into rails:master Aug 23, 2017

2 checks passed

codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

rafaelfranca added a commit that referenced this pull request Aug 23, 2017

Merge pull request #30213 from ckundo/ccundiff-alt-text-default
Do not generate default alt text for images

y-yagi added a commit to y-yagi/rails that referenced this pull request Aug 23, 2017

astronaut-wannabe added a commit to crimethinc/website that referenced this pull request Apr 17, 2018

Update spec to remove image `alt` tag
The `image_tag` helper no longer generates a default alt tag from the filename.

The reasoning is explained in [rails PR #30213][0]

Since we don't have custom `alt` tags written up for the book images, I just
removed the `alt` tags from the spec expectations

[0]:rails/rails#30213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment