geelen / x-gif

A custom element for flexible GIF playback
http://geelen.github.io/x-gif
2k stars 112 forks source link

[Accessibility] Make frames invisible for screen readers #31

Open theanxy opened 10 years ago

theanxy commented 10 years ago

The most important issue to solve is to hide images from screen readers, solved by:

We don’t need to force labels for every gif image, as most of them will have blank alternative text for sure.

geelen commented 10 years ago

I don't think you need the role on the image elements if they're within the role='presentation'?

Thanks for the PR though, gonna go through and merge a few in the next couple of days.

theanxy commented 10 years ago

@geelen Role='presentation' on the container is enough as it should hide its children. As a rule of a thumb, all imgs need an alt attribute. Empty alt is not an equivalent to the lack of alt. I think that’s what you meant :)

Also I saw your #11, IMHO role='presentation' fits better here than aria-hidden: http://john.foliot.ca/aria-hidden/. Aria-label with role="img" is a great idea, but according to w3c authors MUST provide alternative text or a label determined by the accessible name calculation. I’m leaning towards suggesting to skip role="img" with aria-label, because some authors could skip aria-label and keep the role attr. Role="img" with no alternative content will be worse than x-gif element with no role and hidden from accessibility APIs. I suppose most GIFs out there will have no alternative content anyway. That’s only my view though.

P.S. I’ve decided to open a new PR and skip dist files to keep this as clear as possible.

Cheers and good job :+1: