HTML and CSS Reference
In-Depth Information
Potential Trade-offs
The proper tab order is not always obvious, and it may vary from one user to the next, especially in forms
where input fields advance both horizontally across the screen and vertically down the screen. Nonetheless, any
carefully considered and assigned tab order is likely to be better than the default order the browser guesses
when no tab order is specified by a form.
Mechanics
Seven elements support the tabindex attribute:
a
area
button
input
object
select
textarea
Unifying these is the fact that they are all some form of user input. Thus, each can have an explicit tabindex
attribute.
The value of the tabindex attribute is an integer between 0 and 32,767. (If you have more than 32,768 of
these elements, split the page. It's too large.) Tabbing begins with 1 (or the lowest positive value) and
continues in order to the highest value.
On a page whose main purpose for existing is to get the user to fill out a form, it's reasonable to guess that the
tabs should hit the form fields first. Give each form input element a tabindex attribute, ordered from start to
finish, and make the submit button the last tabindex . I either don't assign tabindexes to links on such a page
or I assign higher tabindexes to them than to the form fields so that they'll be tabbed through after the form.
In many forms, you need to consider not only the logical order of the fields, but also which fields are likely to be
filled out. This is sometimes a hard call to make, but if a field is used only infrequently and is positioned off to
the side, I sometimes leave it out of the tab order to enable the user to more quickly advance through the
common fields.
The tabindex attribute has page scope. Consequently, you need to consider the logical order of the forms,
links, and other controls on the page, not merely the order of controls within any one form. It may seem as
though 32,767 is more indexes than you'll need, but it does allow you to do things such as assign numbers from
1 to 500 to the first form; 501 to 1,000 to the second; and so forth.
Search WWH ::




Custom Search