W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2006

[whatwg] Dynamic content accessibility in HTML today

From: Matthew Raymond <mattraymond@earthlink.net>
Date: Wed, 16 Aug 2006 07:35:15 -0400
Message-ID: <44E302F3.1050503@earthlink.net>
James Graham wrote:
> 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.

   The reason that semantic class names are "best practice" is because
class names that are purely for presentational effects are less useful
when using alternate or user style sheets. Presentational class names
encourage presentational markup, and should thus be deprecated. In fact,
a presentational class name might be applied to elements that have
different semantics just because the author wanted to use the same style
for all the elements, giving the impression that elements are related
even when they're not.

>> 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>?

   Your example only makes sense if you assume a mix of presentational
names and semantics names as class values. For authors that use only
semantic class names, the example is meaningless.

>>    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>.

   What you fail to understand is that user agents will have to have
means of handling the misuse, which means that many of the differences
between |role| and |class| are more conceptual than practical.

>>    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.

   The use case for such classes will become progressively smaller as
XBL2 is introduced and CSS improves.

   Also, solely presentational classes are generally worthless for any
"general purpose processing" that doesn't occur through scripting, so
for user agents with scripting disabled, |class| would degenerate into
nothing more than a selection mechanism for CSS.

>>    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.

   All of this could be done with |class|. The sole purpose for |role|
is to separate presentational classes from semantic classes. Since
presentational classes in semantic markup are highly undesirable, this
condemns |class| to a slow and painful death. Better to deprecate
presentational class names and have |class| handle roles, since many
legacy class names are already roles of one form or another.
Received on Wednesday, 16 August 2006 04:35:15 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:28 UTC