Skip to content
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

Need relaxing option for empty alt check #39

Closed
nschonni opened this issue Apr 17, 2014 · 4 comments · Fixed by #62
Closed

Need relaxing option for empty alt check #39

nschonni opened this issue Apr 17, 2014 · 4 comments · Fixed by #62

Comments

@nschonni
Copy link
Contributor

Alt tags may be left empty for decorative images http://dev.w3.org/html5/alt-techniques/#secm3
It would be good if to have a similar whitelist as the href check to exclude known valid images like "logo.png" where the content is purely decorative. In the decorative case, an empty alt tag prevents screen readers from reading the file name as a fallback.

@gjtorikian
Copy link
Owner

Interesting! I'll have to muse on this. Have you done this yourself? Do people usually use just alt, or alt=""?

I ask because it might be very hard to determine between an empty alt tag and a missing one.

@nschonni
Copy link
Contributor Author

It is usually in the form of alt="" or alt=" ".
An example would be:

<img src="my-unrelated-stock-photo.png" alt="" />

I was thinking of a format like this:

HTML::Proofer.new("out/", { :alt_ignore => [ "my-unrelated-stock-photo.png", "my-logo.png" ] })

Then the space or no space value in the alt tag wouldn't be an issue, it would just short-circuit the lint.

@gjtorikian
Copy link
Owner

Ah, okay, cool. I was thinking of passing in an option but matching alt_ignore the same was as href_ignore makes more sense.

@LaurentGoderre
Copy link

actually, it should be alt="" because alt=" " is a non null alt and will not be ignored by assistive technologies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants