Hicks

skip navigation solutions

I’ve just been reading on The Web Standards Project about the fact that ‘Skip Navigation’ links hidden with the CSS property display:none are invisible to screenreaders. This hadn’t occurred to me, even though I knew it was a problem with Fahner Image Replacement, which uses the same property.

Skip Navigation links give users the option to go straight to the content, useful if you use a textbrowser, PDA or screenreader (doh!). One way around this is to use a layout technique that allows navigation to be placed after the content, removing the need for the link. The Layout Reservoir at Blue Robot has useful examples on how this can be done. Navigation is positioned using position:absolute, which takes it out of the normal flow of the page, allowing it to go anywhere in your HTML. This won’t always be possible of course.

Another way is to use a similar technique to Seamus Leahy’s Image Replacement method at CSS Play, which is known to work with screenreaders. If your skip link looks like this:

<div class="hide"><a href="#content">Skip Navigation</a></div>

Then your CSS would look like this:

.hide {
	height: 0;
	width: 0;
	overflow: hidden;
	position: absolute; /* for the benefit of IE5 Mac */
}

Like display:none, this won’t take up any ‘physical space’. The only browser I found that had a problem with this was IE5 Mac, but it behaved itself after adding position:absolute to the code.

Please note: This has since been tested in screenreaders, and it isn’t quite up to the job. See the next post.