Replies Back to Article

Set tabindex

Tabindexes
October 26, 2003 by Carl Grint

I am not sure if you are simply asking how to assign a Tabindex to links, but you can simply do this by adding tabindex="2" to your <a href> tag.

ie = <a href="link" title="link" tabindex="2">link text</a>

It is best not to use 1 as your tabindex for links as screen readers will read the links first on every page before the text on a page.

You can use 1,2,3,4 etc but a browser will except using 2 for all your links, which is easier if you have a lot of links on a page.

RE: Tabindexes
October 27, 2003 by Ward Conant

No, I know how to set tabindex in the ,ark-up. I want an extension that allows me to do this more quickly for every link in a page. Especially the pages with 100+ links, which the client asks me to add a link to!

 

Thanks anyway

100+ links
October 27, 2003 by Carl Grint

Really if you have that many links on a page, if it is the content, then I would strongly suggest using a database to populate it, and then you can assign tabindex="1" to the dynamic link text on the page, which will work perfectly fine.

Of course for all other links, you should apply the tabindex as you go, so that it will not be a problem.

If you have lots of links, I have found it is easier not to use 1,2,3,4 etc as you might want to change or add one mid way, and it is really annoying having to add tabindex="56" and then update all the following, so using tabidex="1" gets around this for content, and then obviously use tabidex="2" for the navigation links so that the content is the first tab that a person accesses, which is aimed at providing both a more accessible and user friendly experience.

Hope this helps.

RE: 100+ links
October 27, 2003 by Ward Conant

I would love to use a database to populate this site. Want to convince my client of that? Didn't think so (you'd not be able to, at any rate).

And of course I set the tabindex as I go. But ...

Are you suggesting setting the tabindex="1" for *all* links? That does *not* make the page accessible (and defeats the entire purpose of using tabindex in the firsat place).

So, back to my original request: is it possible to create an extension that would allow me to set the tabindex of every link on a page in a convenient manner (e.g., via a floater or some other widget)? I'm interested in the answer to this question, but I am not interested in reasons why I should not ever need to do this.

Thanks again, but please, no more "you don't want to do that" replies. Thanks,.

RE: RE: 100+ links
October 27, 2003 by Ward Conant

OK, after some careful experimentation, I can see now that setting all tabindexes to the same number can work *in certain situations.* It still doesn't feel right, but if (and *only* if) the links/form fields/etc occur in the mark-up *in the order you want to tab through them.* then this will work. However, this condition doesn't always apply. Further, I am still faced with the need to re-assign tabindex values for literally hundreds of page elements across ~100 files. An extension would still be enormously helpful.

 

Thanks

RE: RE: Tabindexes
November 17, 2003 by Edward Apostol

Although a recommended method would be to use databases to store the links, you can do it with javascript using arrays to store the field names , ids, and tabindexes. Then using a loop and document.write statements, have javascript print out your form, using the loop's index to increment the tabindex attribute. The only thing you would have to update is the array containing your field names. In fact, you can use array methods to count the number of array elements, in turn giving you a count of the number of fields to write, which in turn can influence your tabindex increment.

Hope that gives you ideas. I do this stuff all the time.

cheers

Edward J. Apostol