Component Library

Focus Order - Initial Focus on edit field

Issue Description

On page load Initial focus lands in the first form control, text edit field, search, etc.

Recommendation

If initial focus on similar pages or a series of pages in a workflow is inconsistent, set initial focus on the page's first heading or page content. Set the initial focus with <tabindex="-1"> on the page's first <h1> heading to move keyboard focus to the first page heading.

  • If user attention by design needs to be drawn to a specific element when a page loads, such as a username field on a login page, set initial focus on that element with <tabindex="-1">.

https://robertnyman.com/2006/11/13/initial-focus-to-a-text-field-good-or-bad/