Creating an Accessible Checkout Progress Bar

Posted Friday, December 7th, 2007 by Robert Spangler, in eCommerce Web Site Design

All websites (from content to commerce) should be as accessible as possible. I could get into a long series of paragraphed rants about that topic, but I’ll save that for another day :). For more on web standards and accessibility you can check out Roger Johansson’s write up.

One thing that is often overlooked in regards to accessibility and usability is the Checkout Progress Bar.  This article is more of a tutorial for designers and front-end developers on how to build out an accessible Checkout Progress Bar without using hotspots or a large amount of images.

First things first, let’s start with some clean markup:

<ol  title=”checkout Progress”>
       <li>Checkout</li>
       <li>Billing and Shipping</li>
       <li>Confirm Your Order</li>
       <li>Complete Order</li>
</ol>

Which will output the following:

  1. Checkout
  2. Billing and Shipping
  3. Confirm Your Order
  4. Complete Order

Nothing new here, a very simple display of the progress; but we can’t stop there, we need some visuals so it flows with our unique design!
Here’s what I came up with for one of our recent sites (Epic Dental):

Progress Bar for Epic Dental

Make sure that you make an image for each step of the checkout process, one, two, three, and four.

Let’s get our markup ready to be styled:

<ol class="checkout-progress" id="step1" title="Checkout Progress">
       <li><span>Checkout</span></li>
       <li><span>Billing and Shipping</span></li>
       <li><span>Confirm Your Order</span></li>
       <li><span>Complete Order</span></li>
</ol>

First, we simply add a class on the ol called checkout-progress, adding an id called “step1” (so we know that which step we’re currently on), and I’m also adding spans around our text so that we can easily hide the text when we replace it with images.

Now for the CSS:

ol.checkout-progress
{
       position: relative;
       display: block;
       width: 890px;
       height: 37px;
       padding: 0;
       margin: 15px auto;
}
ol.checkout-progress li {margin: 0; padding: 0; display: inline;}
ol.checkout-progress li span {position: absolute; left: -9999px;}
ol.checkout-progress#step1 {background: url("checkout-progress_p1.gif") no-repeat center;}

First we’re turning the ordered list into a block level element so that we can visually replace its contents with our images; the width and height are relative to the size of your progress image you design. I then removed all of the padding and added some margins in there. The “auto” attribute centers the <ol> in the body.

Now we remove all of the margins and padding on the li tags because we’re don’t need it to take up any more space.

There are several image replacement methods available (see more here at mezzoblue). I’m hiding the text by using “position: absolute; left: -9999px;” I was originally using “display: none;” but I later found out that display:none can actually hide the text from screen readers.

What About The Link?

A big reason people are settling for hotspots is because they make it easy to link portions of an image, I’ve included a much more accessible way of doing that, by using the a tag around the text and absolutely positioning it where it needs to be. This method makes it work for you and me, and still keeps things accessible.

HTML:

<ol class="checkout-progress" id="step2" title="Checkout Progress">
       <li><a href="#" title="Return to Checkout" id="step1-link"><span>Checkout</span></a></li>
       <li><span>Billing and Shipping</span></li>
       <li><span>Confirm Your Order</span></li>
       <li><span>Complete Order</span></li>
</ol>

CSS:

a#step1-link {
       display: block; width: 130px;
       height: 37px;
       position: absolute;
        top: 0px; left: 125px;
}

Since the ol.checkout-progress has position: relative on it, our absolute positioning on the #step1-link is able to be positioned wherever it needs to go.

The Final Code:

Need the Final Code? No problem, just check out the demo I prepared, that should be all you need!

Conclusion:

It may seem complicated at first, but once you do one of these it’s very easy to utilize the same code on your next project. There are also a lot of CSS techniques used in this lesson that you’re welcome to use in other places as well. Let’s keep moving towards web standards and accessibility, especially in the details.

8 Responses to “Creating an Accessible Checkout Progress Bar”

  1. December 7th, 2007 at 11:44 am
    Andy Stratton Says:

    This is a great post, Rob. Nothing better than some accessibly aesthetic and semantic markup.

     
  2. December 7th, 2007 at 4:17 pm
    Robert Spangler Says:

    Thanks Andy! I’m glad you found it helpful.

     
  3. November 18th, 2008 at 3:24 pm
    TraiaN Says:

    Hi ,

    Talking about the progress bars, I also did some research on major etailers and how do they display the bar. I wrote an article about the findings, called CHECKOUT - Progress Bar Survey. Take a look and please let me know what you think.

    Cheers,
    TraiaN

     
  4. November 18th, 2008 at 3:25 pm
    TraiaN Says:

    The link to the article should be www.pitstopmedia.com/sem/checkout-progress-bar-survey.

    Thanks!

     
  5. December 5th, 2008 at 12:32 pm
    Justin Says:

    Thank you for that link! I was dying to find samples for this progress bar I have to design. you just saved my day!!!

     
  6. April 9th, 2009 at 12:32 pm
    Craig Higdon Says:

    Great post!

    You might be interested in a similar article that creates CSS custom buttons.

     
  7. January 30th, 2010 at 5:37 am
    Ian Says:

    Hi Andy

    This is an interesting and informative post. I am currently implementing something similar and I have a couple of observations on which I’d be interested in your (and anyone else’s) feedback.

    1. How do you indicate to a screen-reader which item is highlighted? In order to satisfy DDA requirements, information that is conveyed by an image (e.g. the progress bar image) also needs to be conveyed by screen-reader accessible text on the page. For step 3 from your example page I would implement it as below; inserting ” (selected)” after the step name provided within the tags.

    Step 3

    Checkout
    Billing and Shipping
    Confirm Your Order (selected)
    Complete Order

    2. When I last researched the issue, most screen-readers do not come pre-configured to read out the title text of a link. It is entirely possible that this situation has changed, but if this is still the case I would be inclined to further modify the example by placing the “Return to” text inside instead of using title text. I would also be consider using “Back to” and “Forward to”, rather than “Return to” as these re-enforce the ordering by indicating the direction through the process that the user would be moving. Further modifying the above example with the steps above and to add a forward link for the final step this would become:

    Step 3

    Back to Checkout
    Back to Billing and Shipping
    Confirm Your Order (selected)
    Forward to Complete Order

    Many thanks

    Ian

     
  8. February 2nd, 2010 at 2:21 pm
    Robert Spangler Says:

    Hey Ian, I think your solution is right on.

    One thing that might be helpful would be to make the text more conversational such as “You’re currently on step: Confirm Your Order.”

    Thanks for the input, great idea.

     

What Do You Think?