jackmoore / zoom

jQuery plugin for zooming images on mouseover.
http://www.jacklmoore.com/zoom/
MIT License
1.54k stars 460 forks source link

Important accessibility issue! No alt text #143

Open heaversm opened 5 years ago

heaversm commented 5 years ago

Hi! I see that this has been filed previously (#134 ) - but it's pretty crucial (for me at least) to solve, as I'm being sued for accessibility non-compliance (my site uses Shopify, Shopify's theme uses this plugin).

https://github.com/jackmoore/zoom/blob/master/jquery.zoom.js#L92

Seems like the plugin creates a new image element based off the source. Can we get the plugin to copy over the alt text?

jackmoore commented 5 years ago

@heaversm Wow, I was just reading up on accessibility lawsuits yesterday. Sorry this is happening and that I may have contributed to that! I wish the party suing you had done their due diligence before flagging this as an accessibility issue, because I think copying over the alt text would go against accessibility guidelines, rather than the other way around.

Zoom's alt behavior is intentional, and a good faith attempt to provide the best accessibility. The zoomed img element is a copy that gets added to the DOM, leaving the original img (which carries it's own alt text) in place. Putting alt text on the copy doesn't provide the disabled user with any new information and lowers the signal to noise ratio.

Since the alt text is provided in an adjacent DOM element, I'm fairly confident this is what accessibility guidelines would categorize as a Decorative Image, or possibly a Group of Images.

The prescription for decorative images (or a group with a single meaning) is to give the redundant image element an empty alt value. Using an empty string (which is what Zoom does), indicates that the alt attribute is intentionally blank, where omitting the alt would indicate that the attribute was overlooked.

I've tried to determine if adding aria-hidden or role='presentation' would be beneficial, but I just haven't seen any evidence to suggest that it would. I believe adding those on top of the empty alt would be superstitious code. The WAI guidelines prescribe that the empty alt attribute is the right solution.