[whatwg] Predefined classes are gone

Jon Barnett jonbarnett at gmail.com
Thu May 17 20:13:18 PDT 2007


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

I like the idea of an <attn> element more than the other given ideas for
associating a message with a form or form control.  It should have a "for"
attribute, like label:
<label for="password">Enter your new password</label><input
id="password"><attn for="password">Your password is too short</attn>

In combination with a "role" attribute, it would solve issues with form
controls:
<label for="password">Enter your new password</label><input
id="password"><attn for="password" role="error">Your password is too
short</attn>

An <attn> can attach to <form> and <fieldset> elements as well.
<form id="login"><attn role="error" for="login">Logging in was
unsuccessful</attn>...</form>

There might be a use case were <attn> might be able to attach to other
non-form elements.  I can't think of a compelling one.

(The idea of an "attn" attribute above leaves the error message twice
removed from its form control)

I like the idea of a "role" attribute for reasons other than that it's new
and doesn't conflict with exiting "class" attributes.  Authors assume that
the class attribute is theirs to use for scripting and styling without
outside interference from the UA.  Author's don't assume this about the
"rel" attribute.  Authors assume that the UA will assign meaning and
function to the "rel" attribute, such as rel=next.  HTML4 leaves the
possible values for "rel" open-ended, but authors don't use it willy-nilly.
However, rel=nofollow exists because UAs decided to support it.  "role"
should have the same type of existence.

I don't think XHTML2's example values for "role" are useful (except "note"
and "search").  "error" and "warning" are good useful examples.  In the same
vein, I would add "confirmation" or "success".

-- 
Jon Barnett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20070517/12d61ea5/attachment-0001.htm>


More information about the whatwg mailing list