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

Canvas, CSS and ARIA with Form Elements

From: Charles Pritchard <chuck@jumis.com>
Date: Mon, 18 Jul 2011 17:11:59 -0700
Message-ID: <4E24CBCF.5000204@jumis.com>
To: "public-canvas-api@w3.org" <public-canvas-api@w3.org>
Supporting the native shadow dom with pure CSS:

Daniel Christopher recently sent me a link to a project [1] which 
demonstrates pure CSS enhancement of checkbox, radio and range, using 
the native component shadow dom [2] implemented in webkit.

WebKit has selectors: -webkit-slider-thumb for the native input 
type="range" controller:

With ARIA [3] and a scripted environment, you might do something like 
this, as a generic implementation:
<div role="slider"><div aria-grabbed="false"></div></div>

For legacy HTML forms and non-scripted/pure-css environments, and for 
accessibility, you will end up with something like this:
<div><label for="range">Range</label><input id="range" name="range" 
type="range" role="slider" aria-grabbed="false" /></div>

These shadow dom selectors, like slider-thumb, may be useful additions 
to a subsequent ARIA specification.

Supporting the canvas shadow dom via scripting:

With an appropriate WCAG 2.0 level met, the author is free to place
the legacy HTML div tree into the canvas shadow dom [4].

Canvas authors that are not using drawFocusRing are likely not meeting WCAG.

Authors that have not met WCAG may support the native shadow dom (webkit 
example) through
CSS background image and color modifiers, as well as the normal CSS box 

All canvas authors should ensure that canvas shadow dom content is 
intelligible whether
or not canvas is active and available.

Authors are encouraged to be color sensitive when styling background and 
foreground colors;
when supporting background-image, background-color and color should be 
tested as well.

Using options to disable scripting, as well as options to enable high 
contrast mode
and zoom can help when testing color accessibility.

Microsoft IE9 F12 Developer Tools provides compatibility mode testing,
which allows testers to disable Canvas.

"In non-interactive, static, visual media, if the canvas element has 
been previously painted on ... then the canvas element represents ... 
the current image and size. Otherwise, the element represents its 
fallback content instead."

Noscript for Firefox enables testers to easily toggle on-and-off 
scripting; but will "hide" the canvas shadow dom,
which is a bug. Because of this bug, supporting Noscript requires 
additional scripting.

Firefox and WebKit do not currently support delivering focus events to 
the canvas sub-tree and so the shadow dom
is typically placed as an adjacent node to the canvas. IE6 - IE8 can 
support Canvas through the object tag and plugins,
such as Flash and IECanvas. These legacy solutions may require a parent 
div, as the canvas element must be absolutely positioned.

<div style="position: relative"><canvas 

Testing accessibility of Canvas, CSS and ARIA form elements:

As of July 2011, WebKit and Firefox do have drawFocusRing support in 
their code development trees,
though they do support CSS Canvas semantics.

Canvas developers are encouraged to use IE9 F12 Developer Tools and a
Windows MSAA/UIAutomation introspection tool [5][6] to perform keyboard 
high contrast mode and fallback content testing.

A rugged implementation of a slider widget may look something like the 
supporting interoperability through various levels of CSS and HTML.

window.onload = function() { /* scripted canvas */};
var focusChange = function() { /* handle slider */ };
.slider { /* generic css for contrast requirements */ }
input[type="range"]::-webkit-slider-thumb { /* native widget css */ }
<div style="position: relative">
<canvas style="position: absolute">
<label for="range">Range</label>
<input id="range" name="range" type="range" class="slider" role="slider" 
onclick="handleSlider(this, event)" onfocus="handleSlider(this, event)" 
aria-grabbed="false" />


[1] umbrUI - CSS3 range slider, checkbox + radio button

[2] What the Heck is Shadow DOM?

[3] Accessible Rich Internet Applications (WAI-ARIA) 1.0

[4] HTML5 Canvas Accessibility in Internet Explorer 9

[5] aViewer beta  updated

[6] Where did the accessibility tools go?
Received on Tuesday, 19 July 2011 00:12:33 UTC

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