Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Robert Tyree
Robert Tyree
13,335 Points

Tabindex greater than one = bad?

Just a note from this slightly updated course that a tabindex of greater than one is generally not advised!

https://teamtreehouse.com/library/tab-order

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

2 Answers

Steven Parker
Steven Parker
229,608 Points

I'm dubious of the "bad idea" advice.

I don't know who those guys are, but the the definitive resource I rely on is MDN.

The MDN page for tabindex doesn't seem to have any warnings or recommendations against using it. The one thing I might agree with the other guys on is that there could be better ways to get what you're ultimately after.

Robert Tyree
Robert Tyree
13,335 Points

I hear you, but pretty sure it stands up.

HTML5.2 working draft: "Warning: Using a positive value for tabindex to specify the element’s position in the sequential focus navigation order interacts with the order of all focusable elements. It is error-prone, and therefore not recommended. Authors should generally leave elements to appear in their default order."

https://www.w3.org/TR/html52/editing.html#the-tabindex-attribute

Also: http://adrianroselli.com/2014/11/dont-use-tabindex-greater-than-0.html

Steven Parker
Steven Parker
229,608 Points

So we can expect this might get deprecated in future software. For now the risk is confusing the user, and the inclination to use it is probably a sign that you really need to rethink your layout.