Skip navigation.

JavaWoman considers…

(perfectly ordinary adventures)

Skipping along

, , ,

Coded for accessibility - almost

accessibilityOne major reason I chose My Opera as a platform for a photo album, and then also as a blogging platform, was its clean, lean, and valid code (well, almost valid). Looking at the source code, I noticed there was even code to enhance the accessibility of the site, such as a “Skip navigation” link - a good thing with all of the navigation links at the top of every page. Unfortunately there is a problem with this link: while the link is present in the XHTML code, the accompanying CSS code makes it disappear completely, so it won't actually be there anywhere except in browsers that do not support CSS. Luckily, My Opera also provides a way for us to use or add our own stylesheet, and we can use that to repair this problem.


Skip navigation - whatever for?

Every page on My Opera starts with a top bar with a bunch of useful links to get to various sections of the site, some of them neatly wrapped up (by means of CSS) in dropdown menus. You probably don't see that, but if you're not logged in there are 18 links in all. The top bar is then followed by a banner, and below that is a menu bar in which the number of links depends on the member's settings for their site, but 6 more links is not unusual.

If you look at the page, you take all that in at a glance. In fact, if you're just browsing a member's site, you probably don't pay much attention to it, except maybe the menu bar below the banner. We are very good at not noticing what isn't important to us. If you want to see someone's photo albums, a single click on “Photos” will get you there.

Now imagine you cannot click. Think for a moment about what your fingers, and hand, a whole bunch of muscles, and a string of nerves and your brain actually do when you move your mouse and click on something. Some people can't use a mouse, because their hands aren't as nimble-fingered as yours, but they may be able to hunt-and-peck at a keyboard. Now, using only the keyboard, how do you get to the header of the first blog post on a page, so you can follow that link to read the full post? With a lot of keystrokes, is how. In most browsers that means using the TAB key to move from one link to the next, until you get to the one you want, and then you hit the Enter key to follow that link. Opera (and with it a few other browsers) does it a little differently, but it's still a lot of keystrokes to get past those 24 links. *) That soon gets boring (or even tiring) if you're going to read more than a single page on a site, because you have to repeat that whole string of keystrokes again on every page before you can start reading.

That's the kind of situation a “Skip navigation” link was invented for: so that people who are dependent on the keyboard because they cannot use a mouse need to get only to the first link which will take them in one big jump past all the other navigation right at the start of the actual content. So obviously such a “Skip navigation” link has to be right at the start of the page, and link to the start of the actual content.

There are other groups of people for whom a “Skip navigation” link is useful. For instance people who have bad eyesight but can still use a graphical browser provided everything on the screen is blown up really large: most of them use special screen magnification software. But that way you may be able to see only a few words at a time, so you cannot take in the whole top area with top bar, banner and menu “at a glance”. A Skip navigation link allows them to jump straight to the actual content. And then there are people who cannot see at all, and depend on a screen reader: a program that either reads text on-screen aloud, or sends it to a Braille device (or both at the same time) to use a computer and browse the web: they depend on the keyboard as well, so they profit from “Skip navigation” instead of having to TAB through (and listen to) all those 24 links on every single page here. It's for them as well.

So why can't you see it on your blog?

HTML code with 'Skip navigation' link

My Opera has a “Skip navigation” link in exactly the right place (see above) in the HTML code, but then uses CSS to hide it for everyone (see below), which is rather disappointing. As a result, the link will be visible (or audible) only for those who use a browser that does not support CSS.

CSS makes the link disappear
There is still a wide-spread misunderstanding that “skip” links are only for blind people, and that even if you hide such a link with CSS, they will be able to use it.

Now some blind people use a text-only browser like Lynx, so they'll benefit, but they form only a small part of our target group. While some older versions of screen readers still read text hidden by CSS ‘display: none;’, the current versions are standards-compliant and correctly ignore content that is hidden this way. Why My Opera is hiding it this way, thus breaking the (in principle) provided accessibility, I can't fathom, but there is still a wide-spread misunderstanding that “skip” links are only for blind people, and that if you hide such a link with CSS, they will be able to use it. But as I explained, such links are useful for a lot of people who are not blind (who won't find it if it's hidden); and if you hide it with CSS, screen readers won't read it either. (Maybe Fred should have a chat with Chaals? :wink:) But the code can easily be repaired, and I'll show you how.

Making it accessible

The first - essential - step is easy enough: the official stylesheet uses display: none; to make it disappear, so we just make it re-appear:
Code to unhide the link

That will make the link appear above the top bar, pushing the rest of the page down. It's usable now, but it looks ugly. The aim is to put it on the top bar; putting it before the My Opera logo will look ugly, too, so let's put it on the right-hand side:

Code: floating the link

That works - but now we have a problem: the link is no longer clickable! Floating the link takes it “out of” the text flow, so the whole top bar moves up again; but because it comes after the link in the source code, it ends up on top of the link: we can see it through the transparent top bar, but not reach it. There are various solutions for that, but what I added was this:

Code: making the link clickable again

Now things are nicely balanced: with a wide screen, the top bar menu shifts all the way to the left, while the Skip navigation link shifts to the right, to the edge of the browser window. With a smaller window (I have mine always 800px wide), it's quite obvious though that the Skip navigation link doesn't sit on the same base line as the top menu, so let's shift it down a little by giving it a top margin. Also, the link appears in my default text font while the top menu is different; to make it fit in, we give it the link the same styling. Finally, we also hide the stupid period after the link, by giving the paragraph a little negative margin, and making the color the same as the background (for those browsers that don't support negative margins). We end up with this CSS code then:

    /* accessibility */
body > p.hide
{
  display: inline !important;      /* make link visible */
  float: right;                    /* position at right */
  margin: 12px -5px 0 0;           /* same baseline as menu links, hide the dot */
  color: #DDDDDD;                  /* hide the stupid dot again */
}
body > p.hide a
{
  padding: 3px;
                                   /* same styling as #myo */
  font-size: 75% !important;       /* approximate match with menu (#myo has 12px) */
  font-family: 'trebuchet ms','lucida grande','lucida sans unicode',arial,helvetica,sans-serif !important;
  font-weight: bold;
}
    /* top bar menu */
#myo2
{
  float: left !important;
  width: 80% !important;           /* orig: 920px */
}

This is what I ended up with in Firefox (not logged in) and Opera (logged in) - all nicely lined up:

All lined up: Firefox, not logged in
All lined up: Opera, logged in

A quick test with the WAVE toolbar now also points out our Skip navigation link as an "accessibility feature":

WAVE points out accessibility feature

Actually, I did a little more (like making the top bar narrower), but after the March release *) I had to redo that whole lot again, no use describing that now.

To be continued…

*) Footnote:

Much of this article was written before the “March release” which changed a number things (dramatically so for some) - and set me scrambling to make it all neat and orderly again instead of writing. It also made the Skip navigation link even more necessary: now there are not only 24 links, but also 4 extra form controls to get past - and as many extra keystrokes in most browsers. If you want to keep the form, extra styling is now necessary so it doesn't clash with the Skip navigation link we made visible. If you don't want the form there at all, you can just hide it, and apply the methods described above to make the skip navigation link visible and put it on the top bar. Hide the form like this:

#top-search {display: none;}

I'll describe my latest tweak with a slight modification of the form and better visual combination of the form and the skip navigation link in a later article.

Tagged: , , ,

FAE: More toolbar goodnessA first (I think): snow on my birthday!

Comments

Anonymous 25. March 2008, 09:38

DarTar writes:

Hello Marjolein,

I know a web application that would tremendously need an accessibility facelift ;)
Talk to you soon?

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies