SVG + WAI-ARIA

2 posts / 0 new
Last post

Hi,

Using ARIA to enhance SVG accessibility as described on http://blog.paciellogroup.com/2013/12/using-aria-enhance-svg-accessibility/ will make the EPUB file invalid.

The following

<svg xmlns=http://www.w3.org/2000/svg role="img" aria-labelledby="title desc">
<title id="title">Title</title>
<desc id="desc">Description</desc>
<circle role="presentation" cy="60" r="55" stroke="black" stroke-width="2"
fill="red" />
</svg>

won't pass ePubCheck and the following errors occur:

- attribute "role" not allowed here;
- attribute "aria-labelledby" not allowed here;

I allow myself the citation of Romain Deltour, which replied to this "issue" on Twitter :

“+1. It’s primarily a “spec” issue, so w/b fix in 3.1 earliest. But epubcheck might be fixed to be more permissive.”

Link : https://twitter.com/rdeltour/status/468508698693099520

Keep up the good work!

SVG 1.1, used by EPUB, simply does not have such attributes.
For example SVG tiny 1.2 already has attributes like role and RDFa.
The current draft for SVG 2 shows already aria attributes, but it will take some time, until this version of SVG will become a recommendation.
Obviously aria, role and RDFa attributes are already defined as extensions for the HTML5 draft and there are already recommendations for XHTML+RDFa, therefore one can use the attributes
from the XHTML namespace with the corresponding prefix - this is ok for SVG 1.1, but often validators have problems with content from other namespaces and give wrong error messages.

Additionally note, that the information you try to provide in your example with these attributes is almost redundant anyway for SVG.
The file is an image by default (Content-type: image/svg+xml). And the title of the root svg element always provides a title for the complete document and the desc element a description correspondingly.
There is no need to indicate this, because every EPUB viewer has to understand SVG anyway, therefore even for a non visual presentation every viewer has to know at least where to find this text representations/alternatives of the SVG document.
If other elements within the SVG do not have own title and desc elements, it is implicated, that the title and desc of the root element are sufficient to provide a text representation/alternative.
Especially if an SVG document has no title element, it can be safely assumed, that it is purely decorative and provides no further information.
For relevant fragments with an own meaning within the document simply use additional title and desc for those elements in SVG 1.1 to provide a more detailed text alternative than just the desc element for the root element.

Secondary menu