[whatwg] RFC: <input type="username">

David Goss dvdgoss at googlemail.com
Fri May 7 03:07:06 PDT 2010


I think using the role attribute is the best solution here:

<input type="text" role="username">
<input type="email" role="username">

This way we're using the type attribute to indicate what sort of data
is being entered, and the role attribute to indicate how it will be
used. I think the separation of these is sensible, although it's not
entirely consistent across the spec (in my model, "search" would be a
role on a type="text"). It's also backwards compatible with HTML4 and
with current implementations of HTML5, and could tie in with the rest
of ARIA's roles model.

The same concept could, for instance, also be applied to a signup form
where there is a check box for opting in to marketing:

<input type="checkbox" role="optin">

You'd need to use a role attribute of "login" or "signup" on the form
as well to give context to things like role="username" so the browser
would know what behaviour is appropriate. As someone pointed out, the
form element isn't always available if you're working with ASP.NET, so
it would seem right to make the roles legal for fieldset, section and
div as well. In fact, it would seem right anyway because you could have
something like an ecommerce site where there's a single form to place
an order which deals with payment for the current order as well as
signup for the account.

David Goss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100507/75b6384c/attachment.htm>


More information about the whatwg mailing list