Skip to content
This repository was archived by the owner on Jul 3, 2024. It is now read-only.

Fixed missing 'alt' attributes #3

Closed
wants to merge 1 commit into from
Closed

Conversation

jkorff
Copy link

@jkorff jkorff commented Jan 25, 2015

When using the original plugin I noticed that 'alt' attribute content was not carried over.

Good alternative content of images is important to sites which want to be WCAG 2.0 compliant and accessible to visitors with visual disabilities.

I noticed that the problem was in the regex, especially if there were more than one spaces before the 'alt' attribute.

After a bit of research I decided to replace the regex with DOMDocument() which makes it much easier to extract tags and their attributes.

To get tag attributes it’s easier to use DOMDocument() than trying a
regex.
@aarongustafson
Copy link
Member

Thanks! I typically leave alt empty as the source content around the pictures tends to be enough context, but I appreciate the tweak. I will review and respond if I have questions.

@jkorff
Copy link
Author

jkorff commented Jan 26, 2015

Hi Aaron,
understand your point of view, and a lot of others think that way. But
to be truly accessible one has to explain an image's content in its alt
attribute. It's also a mandatory requirement for many WCAG 2.0 compliant
sites, especially government and educational.

Putting on our global hat it's a good idea to support this. Users can
still choose to leave the attribute empty.

Cheers,
Jens

Creative Spirits http://www.creativespirits.info

One way to really learn about Australian Aboriginal
culture.www.CreativeSpirits.info http://www.creativespirits.info/ |
Tips on Facebook http://www.facebook.com/creativespirits.info

On 27/01/2015 5:36 am, Aaron Gustafson wrote:

Thanks! I typically leave |alt| empty as the source content around the
pictures tends to be enough context, but I appreciate the tweak. I
will review and respond if I have questions.


Reply to this email directly or view it on GitHub
#3 (comment).

@aarongustafson
Copy link
Member

understand your point of view, and a lot of others think that way. But
to be truly accessible one has to explain an image's content in its alt
attribute. It's also a mandatory requirement for many WCAG 2.0 compliant
sites, especially government and educational.

I think you missed my point. Often (in my case) these images are supplementary. If you are writing a paragraph about a refrigerator and you have an image of a refrigerator, the alt text is redundant and a little annoying from a screen reader perspective. Leaving an empty alt attribute (alt="") lets the reader skip the image as superfluous. Similarly, no one wants to hear vacuous copy like "man throws frisbee to golden retriever" unless it really adds something to the content. If the image is on a pharmaceutical page, for instance, it probably doesn’t. If it is on a frisbee site, maybe it is (but I’d probably argue for a rewrite).

As this was originally built to scratch my own itch, that’s how I used it. I rarely include alt text unless it really adds something (and with figure/figcaption, I often just expose the text). That said, I am game for the fix, just have not had a moment to test and incorporate it yet.

PS - I used to run the Web Standards Project and and a lot of my work centers around accessibility. (See my book)

@aarongustafson
Copy link
Member

I incorporated some of your changes along with another I needed to make. I added you as a contributor in the plugin masthead as well.

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

Successfully merging this pull request may close these issues.

2 participants