Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improve changelog entry from #9221 [ci skip]

  • Loading branch information...
commit b1c72a3675d57a3a575563acbc120d125d2c667b 1 parent 7765ee0
Carlos Antonio da Silva carlosantoniodasilva authored
28 actionpack/CHANGELOG.md
View
@@ -1,23 +1,21 @@
## Rails 4.0.0 (unreleased) ##
-* Fix `image_alt` method to work with underscored or hyphenated file names.
- Currently, underscored filenames become
- `<img alt="A_long_file_name_with_underscores"` in HTML, which is
- poor for accessibility; Apple's VoiceOver Utility pronounces
- each underscore. "A_long_file_name" thus becomes "A underscore
- long underscore file underscore name." This patch makes underscored
- or hyphenated file names (both of which are very popular naming
- conventions) read more naturally in screen readers by converting
- both hyphens and underscores to spaces.
+* Change `image_alt` method to replace underscores/hyphens to spaces in filenames.
- Example:
- # current implementation
- image_tag('underscored_file_name.png')
- #=> <img alt="Underscored_file_name" src="/assets/underscored_file_name.png" />
+ Previously, underscored filenames became `alt="A_long_file_name_with_underscores"`
+ in HTML, which is poor for accessibility. For instance, Apple's VoiceOver Utility
+ pronounces each underscore. `A_long_file_name` thus would be read as `A underscore
+ long underscore file underscore name.` Now underscored or hyphenated filenames
+ (both of which are very popular naming conventions) read more naturally in
+ screen readers by converting both hyphens and underscores to spaces.
- # this patch
+ Before:
+ image_tag('underscored_file_name.png')
+ # => <img alt="Underscored_file_name" src="/assets/underscored_file_name.png" />
+
+ After:
image_tag('underscored_file_name.png')
- #=> <img alt="Underscored file name" src="/assets/underscored_file_name.png" />
+ # => <img alt="Underscored file name" src="/assets/underscored_file_name.png" />
*Nick Cox*
6 actionpack/lib/action_view/helpers/asset_tag_helper.rb
View
@@ -215,11 +215,11 @@ def image_tag(source, options={})
# Returns a string suitable for an html image tag alt attribute.
# The +src+ argument is meant to be an image file path.
- # The method removes the basename of the file path and the digest,
+ # The method removes the basename of the file path and the digest,
# if any. It also removes hyphens and underscores from file names and
# replaces them with spaces, returning a space-separated, titleized
# string.
- #
+ #
# ==== Examples
#
# image_tag('rails.png')
@@ -227,7 +227,7 @@ def image_tag(source, options={})
#
# image_tag('hyphenated-file-name.png')
# # => <img alt="Hyphenated file name" src="/assets/hyphenated-file-name.png" />
- #
+ #
# image_tag('underscored_file_name.png')
# # => <img alt="Underscored file name" src="/assets/underscored_file_name.png" />
def image_alt(src)
Please sign in to comment.
Something went wrong with that request. Please try again.