register

reset password

This is a not-uncommon way to present a log-in form. Unfortunately, the links inturrupt the flow of tabbing from one input to another.

Normally we'd use tabindex to manage the flow, but what if this form is in the middle of a long page? (For example, in a blog post's comment section.) Managing those attributes on a long page of elements is something worth avoiding.

This jQuery snippet looks for elements with specific attributes to tell it when to take over tab navigating. data-tabmaster="true" tells it when to start, data-tabto tells it where to go next, data-tabmaster="false" tells it when to stop.

It will ignore data-tabto (and set the tabMaster variable to false) if the shift key is engaged, so tabbing backwards gives you the natural tab flow.