autoFocusProps
Reports autoFocus props that are not set to false.
✅ This rule is included in the jsxlogicalandlogicalStrictpresets.
Auto-focusing elements automatically grab the user’s focus, which is generally disruptive behavior. It can be particularly disruptive to users who rely on screen readers and/or keyboard navigation.
Consider letting users focus elements manually instead.
Examples
Section titled “Examples”<44AE spans="tyle--0:#7F">D44AE>ECE6bu DBC <44AE spans="tyle--0:#7F">D44AE>ECE6bu D <44AE spans="tyle--0:#7F">D44AE>ECE6bu D When Not To Use It
Section titled “When Not To Use It”If you have specific use cases where auto-focus is necessary for user experience (such as modal dialogs), you may want to disable this rule for those specific cases. Auto-focusing elements should only sparingly be used when explicitly triggered by users.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Biome:
noAutofocus - ESLint:
jsx-a11y/no-autofocus - Oxlint:
jsx-a11y/no-autofocus
