[whatwg] Dynamic content accessibility in HTML today

James Graham jg307 at cam.ac.uk
Wed Aug 16 03:11:45 PDT 2006

Matthew Raymond wrote:

>> The role attribute currently describes behavior, and is added so that 
>> users with disabilities know what the behavior for a given element is, 
>> according to well-known semantics. CSS is supposed to be for 
>> presentational. In your scenarior, will there be any way to easily know 
>> whether one of the items in the class attribute describes the behavior 
>> is purely presentational?
>    Well, authors are not supposed to put in purely presentational class
> names to begin with

Show me a spec that says that in a normative way. It is merely a "best 
practice". Class names, in general, are meaningless and meaningful class 
names should not be part of the core specification.

> I have yet to hear an
> argument with regards to why |class| can perform the same functions that
> |role| can, especially given the allowance in the HTML 4.01 spec for
> "general purpose processing".

Of course, if you plan to put all the semantics of a document in the 
class names, we could do away with many elements. Do you object to <div 
class="h1"> as a replacement for <h1>?

>> Otherwise, both authors and machine processors 
>> will be easily confused by it.


>    The values for |role| are nothing more than a new set of class names,
> and there is nothing preventing the user from putting in unidentified
> |role| values for presentational purposes and then styling them via CSS
> using attribute selectors. So aside from being mildly harder to select
> from CSS, |role| values are potentially no more semantic than |class|
> values.

Authors can misuse anything. <h1 style="font-size:12px; 
font-weight:normal;">This is the main text of my document put in a 
heading so that search bots think that it's really relevant and useful</h1>.

>    However, let's assume that people would only use semantic values in
> |role|. What becomes of |class|? We use it only for styling? That won't
> work, because HTML is supposed to be semantic.

We use it for it's purpose - to provide hooks to enable presentational 
languages to couple to arbitrary groups of elements on a page. This kind 
of non-semantic hook is _necessary_ so that the temptation to abuse the 
semantic elements is greatly reduced.

>    So what we end up doing is replacing |class| with an attribute named
> |role| that has more rules but otherwise does the same thing.

No. We add an attribute which conveys specific semantics ("this element 
is being used as a UI widget of a particular type). We standardize some
well-researched values for that element that are applicable to the needs 
of non-visual UAs in the real world.

More information about the whatwg mailing list