Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
216,149 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
216,149 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.