Drawing a Focus Ring
Digging further into the Canvas Specification, we find some functions that have not
yet been implemented. The drawCustomFocusRing()
function applies to the
Canvas current path and is used for accessibility. The context.drawSystemFocusRing(element)
function
should allow the given element to have a focus ring drawn around the
current default path. Currently, almost no browsers support this function.
Eventually, you should be able to apply this to the Canvas and also check
to see whether the focus ring should be displayed by using the following
function: var shouldDraw =
context.drawCustomFocusRing(theCanvas);
. If this returns
true
, a custom focus ring on the
current path should be displayed.
Get HTML5 Canvas, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.