Skip to content

empty-content

Reports a link, button or heading with nothing in it and no aria-label, title or binding to innerHTML, innerText, outerHTML or textContent. Text, an interpolation, a block or an element inside counts as content, whatever the element is.

A link, button or heading with no accessible name is announced as just “link”, “button” or “heading”, so a screen reader user cannot tell what it does or where it leads, and a heading adds an empty entry to the outline of the page.

Reported
...
<div (click)="a()" (keydown.enter)="a()" tabindex="0"></div>
<div on-click="a()" role="presentation"></div>
<button (click)="a()"></button>
<a (click)="a()" routerLink="/x">x</a>
...
<app-card (click)="a()"></app-card>
...
<div (mouseout)="a()" (blur)="b()"></div>
...
<input id="a" /> <label for="a">Name</label> <label [for]="id">Name</label> <label><input /></label>
@if (ok) { <a></a> }
<h2></h2>
<a [innerHTML]="html"></a> <a><img alt="x" /></a> <a aria-label="x"></a> <a>{{ x }}</a>
...
<dialog><input autofocus /></dialog>
...
angular:
lint:
rules:
empty-content: warn # off (default), warn, error
html:
lint:
rules:
empty-content: warn # off (default), warn, error
svelte:
lint:
rules:
empty-content: warn # off (default), warn, error
vue:
lint:
rules:
empty-content: warn # off (default), warn, error

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

Suppress one line with sudsy-disable-next-line empty-content 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 elements-content full