[whatwg] Predefined classes are gone

Ian Hickson wrote:
> In response to overwhelming feedback on this issue (especially in blogs, 
> forums, and mailing lists other than this one, like www-html and 
> public-html) I've removed the predefined classes. They're opaque again.
> 
> The main use cases for predefined classes can mostly be dealt with using 
> some of the new elements. class=note and class=example, for instance, can 
> instead use <aside> elements, class=copyright can use <small>, etc.

The use cases for "error", "warning" and "search" aren't yet covered 
well with other elements.

* class="search"

The aim of this one was to be able to indicate the form specifically 
used for searching. This would then allow UAs, especially assistive 
technology, to implement keyboard shortcuts or other mechanisms for 
taking the user directly to the search form.  role="search" is provided 
by the role attribute spec for a similar purpose, and Safari also has 
<input type="search">.  I would prefer the new input type because it 
also has direct benefits for regular users, not just those with 
assistive technology.

* class="error"

The original idea for this was for indicating error messages, 
particularly related form fields.  The problem is that screen readers, 
when in forms mode, only read the content of form control labels, which 
has resulted in authors having to write any error messages within 
labels, which is kind of a hack.  Labels and error messages should be 
able to be separated and providing a way to specifically indicate them 
would allow screen readers to indicate their presence to the user and 
read it on request.

* class="warning"

This is similar to "error", but I can't recall the specific use cases.

There are various possible solutions to replace error and warning, some 
of which include the following.  (This is just brainstorming, neither of 
these are particularly well thought out ideas.)

1. New <attn> element (short for 'attention'), which is specifically for 
attracting the users attention, which is exactly what errors and 
warnings do.

2. A new attribute on <label> to associate it with a related error message.
e.g. <label for="ctrl" attn="ctrl-error">Foo</label>
      <input id="ctrl">
      <span id="ctrl-error">You filled in an incorrect value</span>

The <attn> element is more generic and could probably solve other 
similar use cases, whereas the the label attribute would only 
specifically solve the form error use case.

-- 
Lachlan Hunt
http://lachy.id.au/

Received on Thursday, 17 May 2007 17:43:45 UTC