Skip to content

Files

Latest commit

 

History

History
23 lines (17 loc) · 446 Bytes

no-autofocus.md

File metadata and controls

23 lines (17 loc) · 446 Bytes

Pattern: Use of autofocus

Issue: -

Description

The autoFocus prop should not be used as it can create usability issues. Autofocusing elements can disorient users, especially those using screen readers, by moving focus unexpectedly.

Examples

Example of incorrect code:

<input autoFocus />
<button autoFocus="true" />
<textarea autoFocus={true} />

Example of correct code:

<input />
<button />
<textarea />