-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Warns against empty alt attributes for images, but should not #2398
Comments
I must confess that I didn't search if the test is in Pelican or in Python-Markdown. I let better people do the inquiry. |
I believe this warning provides more value than harm, since it encourages folks who might otherwise omit alternative text to provide it and improve accessibility. That said, there might be a way to address cases in which alternative text is not useful. What if we used a special indicator, like
In the above case, Pelican could suppress the warning. What do you think? |
@justinmayer Adding an useless text decreases accessibiliy (the screen reader reads aloud the useless text). Empty alt attributes are a good thing for accessibility, in the case of useless images. I suggest to just suppress the warning. An empty ALT is fine for me. https://www.w3.org/TR/WCAG20-TECHS/H67.html https://www.w3.org/WAI/tutorials/images/decorative/ |
What about making the warning optional under a setting? In my image plugins I have it like that. The user then gets to decide. |
We have an option to filter out log messages. Even with an example for this exact case. |
@avaris Great, I missed this option. However, the warning is still spurious. |
I've already proffered my opinion that I find the warning to have its utility in reminding folks to improve accessibility when they can. As @avaris mentioned, given that there already exists a mechanism by which to filter these warnings, I'm not inclined to take further action on this. That said, I'm not opposed if someone wants to add the functionality I suggested above. |
Doesn't work with |
I suggest that this issue be reopened. The problem with the |
This might also be a valid solution, but the special indicator needs to be something that would never be found as the genuine value of an The solution would also need to be implemented in a such a way that (a) Pelican recognizes this special keyword not just in RST/Markdown pages and articles, but also in HTML templates, (b) Pelican checks for this keyword only after Jinja has substituted all relevant variables, and (c) Pelican removes the special indicator from the HTML output, leaving a genuinely empty |
Not true. You can filter by exact message, so you can pick and choose which ones are "expected" and list them in the filter. |
That's still not particularly convenient. A site might have dozens or even hundreds of images with legitimately empty It would be better if each affected image could be tagged in a single place (i.e., at the place it's used) and/or if there were some way of tagging multiple images at once (by referring to images by the page/article on which they appear, or by some pattern in their filenames). |
This warning only applies to the HTML content of articles or pages. The ones in templates won't trigger it. So that's a non-issue. Dozens or hundreds of valid alt-less images in page/article source sounds a bit exaggerated to me but sure I'd be willing to accept that. I'm not opposed to a regex solution if someone is willing to implement that. |
When there is an empty alternative text (Markdown source)
![]({filename}/images/logo.jpg)
, Pelican complains "WARNING: Empty alt attribute for image" but it shouldn't:: when the image is not necessary for understanding the page, it is much better to have an empty alternative text.In this case, if I write
![Logo]({filename}/images/logo.jpg)
, a screen reader, for instance, will read aloud "Logo", which is useless.The text was updated successfully, but these errors were encountered: