Re: ARIA roles added to the a element should be conforming in HTML5.

Lars Gunther On 09-11-09 20.16:

> 2009-11-08 03:41, Jonas Sicking skrev:
>> The harm that I see is loosing the ability to have a clear message for
>> what the right way to do things is.
> 
> This was my fear as well when I tried to suggest a middle ground for 
> this issue. Since it was a awhile I'll repeat myself.
> 
> <a role="button"> should be forbidden when hard-coded onto the page for 
> these reasons:
> 
> 1. It is sloppy markup. Conformant HTML should be the best possible.


If specifically role="button" should be forbidden, then the draft 
should give advice about what to do instead. Probably it should 
advice authors to use e.g. class="button" in combination with 
JavaScript, for setting the role. And probably the same for other 
role values.

 
> 2. It is possibly confusing if JavaScript is turned off, since it will
> not act as a button in that case.


Right.

 
> The validator's error message should be carefully worded to suggest that 
> authors instead of removing @role change the tag to <button>

Thanks to Steven and Stephane's explanations, I'm however now 
skeptical about this part of your advice. If *certain* roles are 
only meant to work together with JavaScript/AJAX, then it sounds 
more correct to advice that role="button" only is valid together 
with JavaScript. Or else one could risk that some would use 
<button> when they should use <a>.

Another way to solve the entire issue would be to specify that 
*user agents* should not respect certain @role combinations, 
except together with JavaScript. Thus, when JavaScript is turned 
off, certain roles should not be respected by user agents. That 
might in fact be the simplest - for authors.

> @role="button" should, however, be allowed if the role is added using 
> JavaScript, and *the spec should say so*.


Are user agents able to act differently based on how it is added?

 
> Since validators do not pick up attributes set with client side scripts, 
> AFAIK, there will be no error message = no "penalty".


One of Steven's issues was that some will validate the DOM.

 
> In my estimation, this is not only a reasonable compromise, but the 
> overall best solution, all aspects considered.
> 
> +
> 
> YUI, JQuery, Prototype/Scriptaculous, Dojo can be evangelized into 
> setting @role dynamically (if that's not the case already) and have 
> their manuals suggest such usage as well.
> 
> If they get it right, so will 95 % of all websites.

-- 
leif halvard silli

Received on Monday, 9 November 2009 20:16:45 UTC