W3C home > Mailing lists > Public > w3c-wai-ig@w3.org > April to June 2010

Re: button with forms

From: Benjamin Hawkes-Lewis <bhawkeslewis@googlemail.com>
Date: Sun, 25 Apr 2010 13:28:44 +0100
Message-ID: <q2lde4cf6d81004250528s8ddc6ac0ifd762550d7a5fb00@mail.gmail.com>
To: Roger Hudson <rhudson@usability.com.au>
Cc: WAI Interest Group list <w3c-wai-ig@w3.org>
On Sun, Apr 25, 2010 at 9:03 AM, Roger Hudson <rhudson@usability.com.au> wrote:
> I understand that the use of the button element could cause some
> IE problems in the past and I was wondering if anyone any knows of
> any issues that might be associated with using the button approach
> now.

"button" is a relatively new addition to HTML. Legacy user agents
like Netscape 4 do not support it at all (the text appears but is
not clickable).

As you mention "button" could "cause some IE problems in the past".
But those IE versions (IE7 and earlier) are still widely used, and
manifest significant bugs in their implementation of "button":

   * The default value of "type" is "button" not "submit".
   * The "innerText" property is submitted as the control value rather than
     the "value" property.
   * All buttons are submitted when submitting a form, not just the
     button actually activated by the user (IE6 and earlier).

See:

   * http://msdn.microsoft.com/en-us/library/ms535211(VS.85).aspx
   * http://allinthehead.com/retro/330/coping-with-internet-explorers-mishandling-of-buttons
   * http://www.peterbe.com/plog/button-tag-in-IE

Whether these are problems "now" depends on your browser support
policy.

If you are only supporting recent browser releases, then I know of
no special problems with "button" beyond those typical of styling
form controls:

   * http://meyerweb.com/eric/thoughts/2007/05/15/formal-weirdness/
   * http://www.456bereastreet.com/lab/styling-form-controls-revisited/button/
   * http://particletree.com/features/rediscovering-the-button-element/

But if (like most web publishers) you continue to support IE7 and
earlier, I would generally suggest using "input" where possible, and
dynamically replacing "input" with "button" when "button" offers
advantages and you can repair these bugs with JS.

--
Benjamin Hawkes-Lewis
Received on Sunday, 25 April 2010 12:37:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 19 July 2011 18:14:33 GMT