-
-
Notifications
You must be signed in to change notification settings - Fork 747
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add empty image alt tag if alt text not specified (#2323)
Middleman's image_tag helper wraps the Padrino image_tag helper. By default, the Padrino image_tag helper adds an alt tag based on the image filename when one isn't explicitly set. Alt text based on the filename is not helpful to users and therefore bad for accessibility. To avoid this, explicitly set an empty alt tag value before calling Padrino's image_tag if the user hasn't specified a value. Co-Authored-By: vixus0 <vixus0@gmail.com> Co-authored-by: vixus0 <vixus0@gmail.com>
- Loading branch information
1 parent
e8cf86f
commit 5d3b695
Showing
8 changed files
with
17 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Feature: Add an empty alt tag for images that don't have alt tags specified | ||
|
||
Scenario: Image does not have alt tag specified | ||
Given the Server is running at "default-alt-tags-app" | ||
When I go to "/empty-alt-tag.html" | ||
Then I should see 'alt=""' | ||
|
||
Scenario: Image has alt tag specified | ||
Given the Server is running at "default-alt-tags-app" | ||
When I go to "/meaningful-alt-tag.html" | ||
Then I should see 'alt="Meaningful alt text"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
1 change: 1 addition & 0 deletions
1
middleman-core/fixtures/default-alt-tags-app/source/empty-alt-tag.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= image_tag "blank.gif" %> |
Binary file added
BIN
+43 Bytes
middleman-core/fixtures/default-alt-tags-app/source/images/blank.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
middleman-core/fixtures/default-alt-tags-app/source/meaningful-alt-tag.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= image_tag "blank.gif", alt: "Meaningful alt text" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters