Description
I find the spec for canvas
wanting clarification for how (or whether) fallback content should be included in the accessibility tree.
Consider these two distinct use cases where an alternative to canvas may be useful:
- The user agent does not support canvas or scripting.
- The user agent does support canvas or scripting, but the user relies on assistive technology (AT) to represent an alternative to the canvas.
Are these compatible? The current spec says
In non-visual media, and in visual media if scripting is disabled for the canvas element or if support for canvas elements has been disabled, the canvas element represents its fallback content instead.
"instead"? This might be interpreted as permission for UA vendors to exclude canvas fallback content from the accessibility tree if the canvas renders just fine. I find that problematic. I notice some ATs handle canvas fallback content quite differently to (say) div content (even though they have the same "generic" semantic).
I'm reminded of how the alt
attribute is a key mechanism for accessibility, but is also presented visually when an image fails to load.
Concrete case: A canvas rendering of a stock ticker. (Aria has the log role for such things, so that's a solved problem).
Where does the accessible alternative belong? In the fallback subtree? Before? After?
How do I make sure the AT 'gets' the fallback content if the browser succeeds in rendering it?
The spec also says that canvas (fallback) content should be non-interactive, and then goes on to list most of the HTML interactive elements. (Operable aria roles are, of course excluded). <input type=text>
appears to be forbidden amongst canvas fallback content. Why? AT users might need exactly this. Maybe the canvas view is just a fancy way of presenting a more modest, accessible DOM alternative (a kind of progressive enhancement).
Basically the spec is not at all clear (for authors and UA vendors) how accessible HTML alternatives may best be associated with canvas presentations, especially interactive ones.
Edit: I am not the first to make these observations. This excellent article from TPGi covers similar ground. Please pay close attention the section on "fallback content"