alphagov/spotlight — pull request #138 by alexmuller (2014-01-10 15:42:10+00:00)
Title: Add WAI-ARIA attributes to graph elements

This commit adds `role=presentation` and `aria-hidden=true` to all SVG elements and figcaptions used for linelabels.

This prevents screenreaders from reading out the text parts of those elements and all their children.

As noted in the comment, [the WAI-ARIA 1.0 spec](http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden) says we may do this to improve the experience for assistive technologies:

> Authors MAY, with caution, use aria-hidden to hide visibly rendered content from assistive technologies only if the act of hiding this content is intended to improve the experience for users of assistive technologies by removing redundant or extraneous content.

The spec follows on by saying:

> Authors using aria-hidden to hide visible content from screen readers MUST ensure that identical or equivalent meaning and functionality is exposed to assistive technologies.

Which we'll do as part of this sprint by providing a tabular representation of graph data, which will be better for screen readers than our graphs could ever be.

The story only specified the `role` attribute. We need to use `aria-hidden` too in order to stop screen readers from speaking the contents of the children of the SVG element.