(t) 514 312 4307 (email) hello@giraffesoft.ca

Label Your Checkboxes and Radio Buttons to Ease Your User's Woes

Posted by: François Beausoleil on 2009-04-30

Whenever I build forms, I'm very careful to always label all my fields. After all, it's good for accessibility, right? Well, it turns out it's also good for usability. Very, very good.

I'm getting older, and as I'm getting older, I get lazier. I like things to be bold and easily reachable. Small targets annoy me these days. Let's take for example Campfire's login page:


A screenshot of Campfire's login page

Let's say you login and want to be remembered. Nothing easier, right? Simply click the checkbox. But you're lazy, and there's this huge label right next to it. Go ahead, click the label. What? Nothing happens? You're right: nothing happens. Here's their code:

<dd>
  <input type="checkbox" name="remember" value="1" />
  Remember me
</dd>

Do you see the problem? I do. The label is not a label. It's not attached to the checkbox. For fun, let's count the number of pixels available to click on: 12×12, or 144 pixels.

Compare that to the following image:


Another remember me with the clickable area highlighted.  This shows 325×21, or 6825 pixels.

In this particular image, we have an area that's 325×21, or 6825 pixels available for clicking on. But this picture is a lie. The full width of my browser's window is availble for clicking on.

To be clear, don't do this:

<form action="#" method="get">
  <div class="row">
    <!-- Don't do this! -->
    <p>Name</p>
    <input id="name" name="name"/>
  </div>
</form>

Instead, correctly set the field's id and label's for attributes:

<form action="#" method="get">
  <div class="row">
    <label for="name">Name</label>
    <input id="name" name="name"/>
  </div>
</form>

If you want to know how significant this is, please have a look at a toy page I made: example labelling versus clickable area.

Very important note: I did not select Campfire out of spite. I contacted Campfire's support department and was told that I should simply click the checkbox. To be fair, all other 37signals applications have correctly attached the label to the input. Other applications and websites have the very same problem:

This list was compiled in April 2009, after 20 minutes of searching.

More Information on the LABEL element and its use

blog comments powered by Disqus