When a user tabs to the last input element in the form, is it bad practice to bring the user back to the first tabindex / input item?
You should generally avoid trapping the user's keyboard focus within a sub-section of content, particularly if that sub-section is presented alongside or within the normal flow of other content. It is non-standard behaviour that a keyboard user wont be expecting, and is particularly disorientating for visually impaired users who cannot easily recognise what is happening. If a user can tab onto an object or into a sub-section, they should ideally be able to tab through and away from it.
There are exceptions for things like modal dialogs which are presented separately from other content and are designed to be interacted with as a separate context, but in those situations there should be a very clear route (such as a close button) to escape and return to the original context.
The relevant accessibility guideline in WCAG is SC 2.1.2 (No Keyboard Trap) which recommends that the user's keyboard focus should not be trapped, or if it is, it should be made very clear to the user how to escape using their keyboard. See also technique G21 which describes how to achieve this.
I think it's not necessary and unintuitive.
- Users will probably fill in the fields top-to-bottom, so when they hit the last field, the form is complete - no need to return to top.
- If user skips a field intentionally, he will probably remember to go back when he's done with other fields. Focusing the first field may be confusing in this case.
- If it's a long form, the Submit button may be scrolled off the screen.
<textarea>fields can't be submitted with
Enter. If the last field is a
textarea, users who prefer keyboard navigation will hit
Tab, expecting it to focus Submit button.
I'm having difficulty imaging a scenario where this would be useful, but you shouldn't force users to do things especially if they are not expecting it.
This causes confusion and inevitably comes off as a mistake more than a planned behavior.
Personally, the last thing I would want while filling data in a form is to have my screen scroll away from where I was. I would immediately think I've accidently hit the wrong key.