Skip to content

interactive-supports-focus

Reports an element with a click or key handler that cannot take focus: no tabindex, not a control or link with href, and no role that is not a widget (heading, listitem, dialog, …). The role of the element is named in the message. Hidden, presentational and aria-disabled="true" elements are left alone.

An element that does something when it is clicked or when a key is pressed must be reachable by the Tab key, or a keyboard user never gets to trigger it. Add tabindex="0" or use a native control such as <button>.

Reported
<div (click)="a()"></div>
<div (click)="a()" (keydown.enter)="a()" tabindex="0"></div>
<div on-click="a()" role="presentation"></div>
...
<a (click)="a()" routerLink="/x">x</a>
<a (click)="a()">x</a>
<app-card (click)="a()"></app-card>
<div role="heading" (keydown)="a()"></div>
@if (ok) { <div (click)="a()" aria-hidden="true"></div> }
...
angular:
lint:
rules:
interactive-supports-focus: warn # off (default), warn, error
html:
lint:
rules:
interactive-supports-focus: warn # off (default), warn, error
svelte:
lint:
rules:
interactive-supports-focus: warn # off (default), warn, error
vue:
lint:
rules:
interactive-supports-focus: warn # off (default), warn, error

Enabled by the presets: html/angular-eslint-recommended.

Suppress one line with sudsy-disable-next-line interactive-supports-focus in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
angular-eslint interactive-supports-focus full