Using the label element for form accessibility

2008-03-09 3 min read Accessibility Firefox Usability Web Eddie

I’ve always been a fan of the <label> element. It’s an incredibly simple way to make a form more accessible. It does two things:

  • It explicitly associates text with a form element, so a screenreader doesn’t have to guess what text goes with what form element.
  • For checkboxes/radio buttons, it gives the user a larger click area, which is useful for people with limited vision (or me, since I always end up missing them!)

You can find a number of simple usage examples on the W3C’s WCAG Techniques page for labels.

I recently discovered something new about the <label> element (new to me). I hadn’t realized that you can associate multiple labels to one form element. This is useful because it allows you to associate even more information with a form element. With it, I could write something like this:

<label for="box">1. </label>

<input type="checkbox" id="box"/>

<label for="box">This is some text with a 
<abbr title="full title name">shrt. title</abbr> other stuff inside.</label>

This isn’t the most useful example, but I think it demonstrates the general idea. [Note: normally, I wouldn’t write out an explicit number, I would use an unordered list. But without major support for CSS counters, I find myself between a rock and a hard place.] My optimism was quickly quashed though, because, as Roger Johansson mentions, screenreaders tend to ignore two labels. I will have to do some of my own testing to find out more, but I find this very disappointing.

Another interesting application is to include labels for screenreaders, while using CSS to hide them from visual users. Just make your label a block element, give it a 0 width (to remove the width it would have taken in the document flow), and move it off-screen. You cannot simply display: none the label, as that usually hides it from screenreaders. I would like to look further into the end result using current technology (hoping for improved results since 2004), but I certainly believe this leaves no excuse for anyone NOT including labels in their forms.

Back to using one label again, I ran into a Firefox Bug where a link is included in a label element. When a link is clicked inside a label element that is associated with a checkbox, the checkbox becomes checked! Hit the back button, and the item will still be checked, with the visual check the only evidence anything happened. You can see how this would not be friendly to a screenreader (not to mention visual users!) IE and Opera both behave without checking the box. If you have a moment, please vote for this bug and help me get it fixed.

Continue reading

Big release day on the webbernet

So I guess it’s simply the time of year. Many big releases today… software, APIs, and more!

First, the biggest. IE8 has been released in initial beta. The release was also included a general overview of IE8’s new features and fixes. It’s actually quite a lot of information to absorb all at once. I’ve skimmed a number of the IE8 whitepapers, and feel the biggest changes are W3C’s WIA-ARIA support, Acid2 compliance, the javascript selectors api, and their assertion of achieving CSS 2.1 compliance. Of course, the devil is in the details, and there is no company for which that statement is more true. They have a lot of work ahead, and we know they talk a good game. The big upside, however, is that they are actually talking about it. Out in the open. Big step, and I applaud them for that.

The other biggest buzz of the day was from Yahoo, in announcing the beta of their Fire Eagle service, an API for broadcasting your physical location to the web. I wouldn’t call it earth-shattering, but I think that there’s a good chance a number of cool things are built with it. Watch the video of it’s introduction, and then take a look here to quickly get an idea of the details. It would appear from the details that it was written in a highly usable way.

Of more direct importance to me, Google has announced their Contacts API. I despise when sites ask me to enter my username/password for other sites. The most offensive request is for Gmail. I don’t have any interesting emails, let me tell you… but I certainly don’t want to let others read them. The Contacts API is a safe way for distribution and use of your Gmail contacts, without threatening the security of your Gmail account or your other Google-stored information. With this, I should be able to sync my Gmail contacts with my desktop mail contacts. I’m very happy about that.

Heading up the long-since-overdue category, AOL has announced they’ve opened their Instant Messenger Protocol, OpenAIM. Finally. I remember ages ago when… well, it’s all in the past now. That’s one big wall that has been broken down between protocols, and hopefully Yahoo and Microsoft will fall in line. It will be great if other apps can finally use the features that have been limited to the AIM client for all this time. I use Adium and Pidgin most of the time (Adium, I believe uses Pidgin’s core), and look forward to seeing what they do with the new open protocol. (On a personal note, hopefully this doesn’t spell any negative news for my friends who work on AIM.)

Continue reading

what I've been up to

2008-01-16 1 min read Firefox Twitter Eddie

Though I doubt it will mean anything to anyone… I threw this diagram together Monday night. It’s my application design for a default NCBI application. I’m pretty excited about it. Not too fancy, but a nice start.

I’ve also been thinking about writing a Firefox extension. It’s about time that I play around with it, and I was thinking that a pretty simple app (like twitbin) would be a good place to start. No plans yet, but… ideas.

Speaking of ideas, when is twitter going to become open source and (then) de-centralized? That would be awesome…

Alright, now time to take the design and make it generic… woo hoo overloading!

Another design tweak

2007-12-18 1 min read Design Firefox Ie Eddie

As you might have noticed, I’ve been a bit pre-occupied recently. And likely will be so in the future. So a design for this site has once again been placed on the back burner. I am good for a tweak-ing, however.

Looks fine in Firefox 2 for mac/pc. Opera, has a small problem, I think due to a varied em interpretation (it’s different on each platform). I tried IE6, and of course, things were missing, but the design as a whole stood up. So a few “non-lazy” changes should do the trick. Having only spent 30 minutes and using :before and :after pseudo attributes, I was surprised IE didn’t send my PC up in flames.

It just occurs to me, it would be nice if I could add a little javascript (for fun, not practical usage). Not sure what I would add it to, however. Oh well, placed on my to-do list after the real design.

Review of High Performance Web Sites

2007-11-19 2 min read Books Firefox Eddie

When I came across

High Performance Web Sites Cover
High Performance Web Sites Cover
High Performance Web Sites; Essential Knowledge for Frontend Engineers on Amazon, I was excited. I’ve been actively using the Yslow plugin for Firebug, and was interested in finding out more. At the day job I can’t implement each of the 14 rules myself, however the plugin is useful none-the-less. It’s terrific to have a checklist to work off of when entering QA mode, that way you’re sure not to forget anything.

For those who are not familiar with Yslow, it is (again) a plugin for the firebug, the addon for Firefox. It tests a website based on 14 varying rules, from server settings to page construction. There are a few on the list that most people haven’t heard of, yet are rather important (I had never heard of an ETag much less known what to do with one). When Yslow came out, I took a peek at the best practices document which briefly explained each of the rules. I wanted to find out more, so I ordered the book. Unfortunately, High Performance Web Sites let me down for just that reason. I didn’t find out much more.

High Performance Web Sites starts off with a table listing alexa’s top 10 U.S. websites (substituting AOL.com for craigslist.org). Then, 14 chapters (one for each rule) are devoted to explaining the rule, and showing how many of the top 10 are implementing it. The final chapter steps through the 10 websites and shows what they do to reduce the load time of their websites.

My problem was that the book really didn’t offer any new information. Basically, the best practices document was explained in slightly greater depth…but only slightly. I was disappointed to find out that there were very few additional ideas in the book… apparently the 14 rules cover the possibilities of writing faster-loading websites (ahem). The chapter analyzing the ten major websites had a ton of room for furthering ideas, but offered a limited few.

I was most disappointed in the book because I had looked forward to more. The plugin itself, and the list of rules are both terrific. Having a concise set of tests to walk through is extremely valuable. I can not say the same for the book. I hope my money went towards further work, yet I wonder how that’s being filtered through O’Reilly (the publisher) and Yahoo (the official creator of Yslow). I recommend reading the Yslow best practices, and taking a look at the Yslow user guide instead.

Continue reading
Older posts