O with occluded right edge to appear also as a C Open Web Components Guides Docs Blog Toggle darkmode

EsLint Plugin Lit A11y: no-autofocus

Enforce that autofocus attribute is not used on elements. Autofocusing elements can cause usability issues for sighted and non-sighted users, alike.

Rule Details

Examples of incorrect code for this rule:

html`
  <input autofocus />
  <input autofocus="true" />
  <input autofocus="false" />
  <input autofocus=${foo} />
  <input .autofocus=${foo} />
  <input .autofocus=${true} />
  <input .autofocus=${false} />
`;

Examples of correct code for this rule:

html` <input /> `;

Resources