Re: drawSystemFocusRing implementation details

On Aug 16, 2013, at 4:11 PM, Rik Cabanier <cabanier@gmail.com> wrote:

> Yes, the spec says that the focus ring is drawn directly into the canvas bitmap.
> I'm unsure how it could work differently (unless it's completely redesigned).

A temporary bitmap would be created and the browser would draw on it, above the current bitmap. Basically, the same thing that happens with HTML/SVG elements (the focus ring is rendered above their backing bitmap).


> 
> element.onfocus = function(e) { ctx.drawSystemFocusRing(e.target); };
> How would this work? The canvas object doesn't know what area of the canvas correspond to an element.

That example is from some old code where the current canvas path corresponds to the element, as it's just got one element as a child.

The hope is to avoid doing a clearRect and redraw step on blur; and as such, avoid the onblur hook when using drawSystemFocusRing.

Received on Friday, 16 August 2013 23:40:53 UTC