W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2010

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

From: David Goss <dvdgoss@googlemail.com>
Date: Fri, 7 May 2010 11:07:06 +0100
Message-ID: <y2peed7f4a91005070307n4fbea881y4ff879b7088aaa2e@mail.gmail.com>
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>
Received on Friday, 7 May 2010 03:07:06 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:23 UTC