Re: HTML Canvas 2D Context Extensions - for review

On Sun, Dec 18, 2011 at 5:41 PM, Richard Schwerdtfeger
<schwer@us.ibm.com> wrote:
> If we have the ability to apply bounds to objects in canvas (the hit testing API extensions) I could live with what Ian has for drawSystemFocusRing and drawCustomFocusRing with some tweeks. I mean it is mostly the Same drawFocusRing divided into two separate APIs. One change would be to remove the step of observing systems settings for focus ring style of a custom focus ring. That makes no sense. If an author wants to create a custom focus ring and not follow system conventions then why have the step in a custom focus ring?

Rich, you're misreading Ian's text here.

Ian's trying to ensure that authors can easily replace default focus
rings with their own drawn rings, they can, but if the user has some
sort of special focus requirements (such as high-contrast focus rings)
these are honoured.

Authors are poorly placed to create focus rings matching the user's
special requirements. This is why, with CSS, authors can override
:focus styles, and users can override them back. If authors draw their
own rings when users have special requirement, users will lose that
control in the case of <canvas> content.

Contrast Step 2 for the two methods carefully:

drawSystemFocusRing: "If the user has requested the use of particular
focus rings (e.g. high-contrast focus rings), or if the element would
have a focus ring drawn around it, then draw a focus ring of the
appropriate style along the path, following platform conventions, and
abort these steps."

drawCustomFocusRing: "If the user has requested the use of particular
focus rings (e.g. high-contrast focus rings), then draw a focus ring
of the appropriate style along the path, return false, and abort these
steps."

If you just want to let the system draw a focus ring, use drawSystemFocusRing.

If you want to draw a custom focus ring, use drawCustomFocusRing but
check its return value is true before manually drawing your ring. If
the user has special focus ring requirements, the system should draw
the ring, the method should return false, and the author should not go
on to draw the ring.

See this code example for how it would be used in practice:

http://dev.w3.org/html5/2dcontext/Overview.html#drawCustomFocusRingExample

--
Benjamin Hawkes-Lewis


--
Benjamin Hawkes-Lewis

Received on Sunday, 18 December 2011 18:26:16 UTC