10/09/03

Comments 12

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.

Technorati TagsTags: , , ,

Comments | RSS

Comments are now closed, but you can still have a jolly time reading what others have left:

#1

talon said 1913 days ago:

If the navigation comes after the content, wouldn't users want a "skip to navigation" link?
#2

Robbert Broersma said 1913 days ago:

Talon: well, of course!
#3

jon hicks said 1913 days ago:

Quite possibly. The thinking is that users will want to read the content first, then choose where to go afterwards. I suppose it depends on the market. At least its possible to hide the links without using display: none.
#4

Robbert Broersma said 1913 days ago:

By the way: the position: absolute is necessary for Firebird 0.6 too, since it still show empty white-space with a height of ca. 1em and a with of 100%.

I use a pargraph with the class 'accessibility' and the text "jump to the text or jump to the navigation".
#5

Andy Budd said 1912 days ago:

Screeen reader users can navigate a page a number of ways, including listing all the headings or page links. Thus if you had the site nav at the end, somebody reasonably proficient in using a screenreader could probably just jump to those links themselves.

The reason behind skip navigation is that for long menu's (10+ items) it can get really dull either waiting for the screenreader to list them all out or tabbing through them. Also if you're mobility is impaired tabbing through a list of even 10 links on every page renders the page unusable.

If the page is marked up properly the user could probably just jump to the first h1, however if your nav bars are big, and situated at the top of the document flow, a skip nav is a good idea.

I like your idea of using the overflow technique. Do you know if it works for all browsers. In the past to do similar I've just positioned the element to the left of the screen, off screen.
#6

jon hicks said 1912 days ago:

Thanks Andy, I should've mentioned explained the 'whys', but you did it more concisely than I would've.

I must admit, in my markup I tend to place h1 before any navigation. Is that bad? I think of h1 as the sites name and place it first.

I've tested this on: Windows IE 5 and 6, Mozilla 1.4, Firebird 0.6.1, Opera 7. Mac: Camino 0.7, Safari, IE 5.2. It certainly works in those, but I've not tested it any further. Placing the link offscreen sounds good too...
#7

Shaun Inman said 1911 days ago:

Why not use: .hide { position:absolute; visibility:hidden; } and reduce the code futher?
#8

Jon Hicks said 1911 days ago:

Good question - I'm not sure if visibility:hidden creates the same problems as display:none, as its effectively 'not there' (rather than not visible to the user - if that makes any sense!)
#9

Dave S. said 1911 days ago:

> I’m not sure if visibility:hidden creates the
> same problems as display:none

It does. http://eleaston.com/bob/screenreader-visibility.html

Check out Tom Gilder's variation though: http://www.mezzoblue.com/cgi-bin/mt/mezzo/archives/000259.asp#c001722
#10

Wilson said 1911 days ago:

what about linking to one stylesheet with the display:none property with media="screen" and another stylesheet with media="aural,braille,embossed" without the display:none property (or any of the other visual styles for that matter)?

are screen readers so noncompliant that they don't know the difference?
#11

Andy Budd said 1908 days ago:

The title tag should really be used as the page name/description (sounds obvious, but many people seem to use it as a marketing message), whereas the h tags should be used to explain the meaning of the content t and, if necessary, break it down into more logical and manageable chunks.

I'd say if a screenreader user was navigating a document by using heading, they'd get a little confused if there was no actual content below the main h1 tag, so best to keep the heading associated with the content they are referring to.

My 2p's worth.
#12

Jon Hicks said 1908 days ago:

I see. So if you did use the h1 tag for the name of the site, as well as the title tag a screenreader would read it twice?

Elsewhere

The Rissington Podcast - weekly shenanigans with Jon Oxton

Hicksmade - unique handmade goods by Leigh Hicks width=

love

Brit Pack: A proud member I love Omniweb Coda Segment Publishing I buy my type from Veer The Forgiveness Project