W3C home > Mailing lists > Public > public-canvas-api@w3.org > July to September 2011

setDrawingFor proposal - was Re: correct and incorrect uses of canvas

From: Charles Pritchard <chuck@jumis.com>
Date: Thu, 18 Aug 2011 17:06:09 -0700
Message-ID: <4E4DA8F1.7080904@jumis.com>
To: Jonas Sicking <jonas@sicking.cc>
CC: Steve Faulkner <faulkner.steve@gmail.com>, HTMLWG WG <public-html@w3.org>, Frank Olivier <Frank.Olivier@microsoft.com>, Richard Schwerdtfeger <schwer@us.ibm.com>, Cynthia Shelly <cyns@microsoft.com>, David Singer <singer@apple.com>, "Tab Atkins Jr." <jackalmage@gmail.com>, Edward O'Connor <hober0@gmail.com>, Canvas <public-canvas-api@w3.org>
On 7/14/2011 1:40 PM, Jonas Sicking wrote:
> So I do think we need to add some sort of API which lets you declare a
> region on the canvas which can be used for hit testing. Possibly do
> Ideally setting the area covered by one of these regions should be
> easy to set while performing one or more drawing operations.
> Adding something like:
> interface CanvasRenderingContext2D {
> ...
>    void setDrawingFor(in Element target);
>    void clearRegionFor(in Element target);
>    void clearAllRegions();
> ...
> };
> Removing an element from the DOM contained inside the canvas, for
> example using removeChild, would act as if clearRegionFor had been
> called with that element passed in. Calling setDrawingFor(null) would
> allow drawing things that should not be associated with any element.

I'm not sure I understand that final semantic. I believe it needs to be 
associated with -some- object,
even if it's an object not in the DOM. The closest I can think of would 
be assigning it to an object
created-on-execution in the shadow DOM. Still.. it's a little confusing. 
So, let me know what you're thinking of there.

> Once a region has been associated with an element, it would act
> similarly to how a<label>  acts. So clicking that region would
> dispatch a "click" event to the element and hovering it would dispatch
> "mouseover" etc.

Sounds straightforward to me.

> There are of course lots of unanswered questions, such as if focus
> outlines should automatically be drawn by the UA if an element with an
> associated region is focused. But the above might be a start.

We have drawFocusRing for that one. Authors should setup onfocus events,
and then run drawFocusRing. It does seem that it'd be -easier- if they could
from the setDrawingFor, but I don't know that it's a necessity.

The UA/AT itself can do what it will, and it could use setDrawingFor as 
a fallback,
when drawFocusRing is not called. Is that something we need to specify, 
or is
that something the implementors can decide on their own?

What other unanswered questions do we have?

I believe that we do want a "z-index" setting. It may only apply
relative to elements in the canvas itself, but it's certainly something 
I'd want to see
both in the accessibility tree and in the hit testing.

Received on Friday, 19 August 2011 00:07:05 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:10:32 UTC