How do I disable tabs for <a> tag

Rakesh picture Rakesh · Jan 19, 2009 · Viewed 50k times · Source

I am using <a> tags for links on a web page. How do I disable the Tab key from selecting either of them?

Answer

Sergey Ilinsky picture Sergey Ilinsky · Jan 19, 2009

Alternatively you could go for plain HTML solution.

<a href="http://foo.bar" tabindex="-1">inaccessible by tab link</a>

The HTML5 spec says:

If the value is a negative integer
The user agent must set the element's tabindex focus flag, but should not allow the element to be reached using sequential focus navigation.