text-content
Angular templatesHTMLVue / SvelteVue / Sveltecorrectnessno fixdefault: offhtml/html-validate-recommended
What it does
Section titled “What it does”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.
Why it matters
Section titled “Why it matters”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.
Example
Section titled “Example”...<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>Configuration
Section titled “Configuration”angular: lint: rules: text-content: warn # off (default), warn, errorhtml: lint: rules: text-content: warn # off (default), warn, errorsvelte: lint: rules: text-content: warn # off (default), warn, errorvue: lint: rules: text-content: warn # off (default), warn, errorEnabled 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.
Upstream equivalents
Section titled “Upstream equivalents”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 |