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

Re: feedback requested: Canvas change for improved hit testing that also facilitates accessibility

From: Charles Pritchard <chuck@jumis.com>
Date: Tue, 05 Apr 2011 14:28:50 -0700
Message-ID: <4D9B8992.4010201@jumis.com>
To: Richard Schwerdtfeger <schwer@us.ibm.com>
CC: Oliver Hunt <oliver@apple.com>, Boris Zbarsky <bzbarsky@mit.edu>, cyns@exchange.microsoft.com, david.bolter@gmail.com, faulkner.steve@gmail.com, franko@microsoft.com, public-canvas-api@w3.org, public-canvas-api-request@w3.org, public-html@w3.org, public-html-a11y@w3.org, public-html-request@w3.org
On 4/5/2011 8:56 AM, Richard Schwerdtfeger wrote:
> - Have canvas manage a hierarchy of last drawn objects to manage the 
> hit test. That which is last drawn is on top in the canvas. So, if 
> there if one object's bounding path overlaps another it is the last 
> one drawn on top that receives the pointing event.
How are setLastDrawn and setClickableRegion reset?

Is it this?:
ctx.beginPath();
ctx.closePath();
ctx.setLastDrawn(elementToReset);

Is it necessary for the UA to perform hit-testing?

I'd prefer to make the data available to the AT, but not require much 
more from the UA than
to keep lists accessible by DOM, and send off the usual ARIA events.

When the user is working with the UA, pointer events can be handled by 
the scripting environment.

This is what I imagine practice would look like:

/* event sent to AT to get bounding box+element,  aria-d attribute set 
on element*/
if(ctx && 'setLastDrawn' in ctx) ctx.setLastDrawn(element);
/* aria-d attribute set on element, css used to position element */
else { element.setAttribute('aria-d', mySimpleClickablePath); 
element.style.left = ...; element.style.zIndex=1; }

<canvas onclick="myReplayPathChain( 
childNodes[...].d/aria-*..isPointInPath() .. element.click(event);">
<input type="checkbox" aria-d="M20,20 40,20...z" /> <!-- normalized svg 
path, 0,0 is from the element -->
</canvas>

Bounding boxes and shapes are exposed to the AT and motivated authors 
can do the same in fallback situations.
The aria-d path represented is not guaranteed to be be the same that the 
author provided hit testing responds to.

This maintains a clean separation between DOM and Canvas 2D,
serializing the relationship and allowing each to exist independently.

In the example, I'm using the aria-d attribute, as aria-* is a reserved 
namespace for AT data.



-Charles
Received on Tuesday, 5 April 2011 21:29:34 UTC

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