anu
anu

Reputation: 351

Tab order jumping to URL after tabindex 0

I have a issue with taborder. In a webpage i have elements with custom tabindex, tab order is jumping to url after tabindex 0 and then returning to tabindex 1. How can i restrict the taborer going to URL. can anyone give idea why it is happening.

Thanks.

Upvotes: 7

Views: 2603

Answers (1)

Jon Uleis
Jon Uleis

Reputation: 18649

You should be starting with tabindex="1".

tabindex="1" (or any number greater than 1) defines an explicit tab order. This is almost always a bad idea.

tabindex="0" allows elements besides links and form elements to receive keyboard focus. It does not change the tab order, but places the element in the logical navigation flow, as if it were a link on the page.

With a caveat:

In theory, tabindex should only be used in cases where:

  • The default tab order is not ideal, AND
  • The tab order cannot be changed by rearranging items in the content and/or by altering the style sheet to reflect the best visual arrangement.

Source: http://webaim.org/techniques/keyboard/tabindex

Upvotes: 1

Related Questions