Document the use of autofocus
It's declarative, simple to implement 90% of the time and improves the UX for frequent users (or dare I say... power users). The benefits compound as you add more as the user can move quickly using the keyboard without having to know fancy shortcuts.
We already use autofocus in a number of places (31 autofocus: results across 30 app/views files).
Should we recommend the use of autofocus where possible and document the guidelines for our preferred use of autofocus? We can document this in the GitLab Design System as well as developer guidelines, if needed.
We shouldn't be adding autofocus to :all_the_things:, a poorly placed autofocus can be a mixture of useless and annoying, depending on the user. The input that is autofocused should be the focal point of the page and we should be able to be reasonably confident that the user intends to use that input when they visit that page.
We should also discuss if we can change the autofocus after initial render, or if we will allow a flexible autofocus. I think at some point a while back issues/new would autofocus the description if it already has a title from the query params... or something... These are cases we should put in guidelines.
I think FE could have a discussion with UX and define some guidelines to help decide where autofocus could/should be added. We can then use this to make the decisions ourselves and even implement linting.
We should also discuss the impact on accessibility.
Tasks
-
Discuss accessibility concerns -
Agree or disagree that this is worth the time and effort -
Work with UX to create autofocus guidelines -
Write guidelines into public documentation (including GitLab Design System) -
Transpose guidelines to linters to catch candidates for autofocus, if possible

