Skip to content

text-content

Reports a <button> with no name: no text (an <svg> counts by the text inside it, such as its <title>), no image with a non-empty alt and no aria-label or aria-labelledby. A title does not count.

A button with no name is announced as just “button”, and the user cannot tell what it does.

To fix, put text in the button or add aria-label.

Reported
...
<button></button>
<button aria-label="x"></button>
<button><img src="a" alt="x"></button>
<button><svg focusable="false"><title>x</title></svg></button>
<button><svg focusable="false"><use href="#a"/></svg></button>
<button><img src="a" alt=""></button>
<button><span>x</span></button>
</body>
</html>
angular:
lint:
rules:
text-content: warn # off (default), warn, error
html:
lint:
rules:
text-content: warn # off (default), warn, error
svelte:
lint:
rules:
text-content: warn # off (default), warn, error
vue:
lint:
rules:
text-content: warn # off (default), warn, error

Enabled by the presets: html/html-validate-recommended.

Suppress one line with sudsy-disable-next-line text-content in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
html-validate text-content partial button only