174 Chapter 5—Canvas
Unfortunately, isPointInPath() does not allow for path transformations: Even if
we had moved the coordinate system 200 pixels to the right before issuing the be-
ginPath() instruction, clicking on the coordinate 75/75 would still return true. It
does, however, take the non-zero fill rule into account when determining inside/
outside; as already indicated for the two code examples, the path to be tested does
not necessarily have to be drawn with fill() or stroke().
5.15.2 Accessibility in Canvas?
The question mark in this section heading is deliberate: Canvas is definitely still
lacking with regard to accessibility. This is partly due to the fact that during the
conception of Canvas, accessibility was given hardly any attention, and partly
due to the nature of the issue—raster-based formats without DOM are innately
anything but accessible.
In the context of the HTML5 specification, SVG with its DOM would probably
be better suited for realizing accessible content. But practice proves that even
big projects, such as the web-based code editor Skywriter (https://mozillalabs.
com/skywriter), use Canvas instead of SVG for the sake of performance, which
really breaks the basic rule stated at the beginning of the HTML5 specification’s
Canvas section: Authors should not use the canvas element in a document when a
more suitable element is available.
The second requirement, demanding that when authors use the canvas element,
they must also provide content that, when presented to the user, conveys essential-
ly the same function or purpose as the bitmap canvas, also does not hold true in
reality. The area between the canvas start tag and end tag would be intended for
such alternatives but is usually only used to specify fallback content for browsers
without Canvas support.
For interactive Canvas applications, the HTML Canvas 2D Context specifica-
tion also suggests including focusable HTML elements in the fallback content,
for example, an input element for each focusable area of the canvas. Authors
should use the method drawFocusRing() to mark with a ring those areas of the
canvas that currently have the focus in fallback. The example listed in the speci-
fication in this context, with a couple of checkboxes that are meant to be kept
synchronous in the fallback and canvas area via drawFocusring(), demonstrates
how complicated the whole thing is and leads us to suspect that this is not the
best solution.
Since July 2009, the Canvas Accessibility Task Force has been trying to remedy
the unsatisfactory situation. They are investigating potential improvements of
focus and cursor management. The first lot of suggestions are on the table, be-
ing discussed intensely, and may well find their way into the specification in one
form or another.
But until that happens, we will just have to deal with it: Accessibility—please hold!