header-scope
Angular templatesHTMLVue / SvelteVue / Sveltecorrectnessno fixdefault: offhtml/html-validate-recommended
What it does
Section titled “What it does”Reports a <th> with no scope (row, col, rowgroup or colgroup) in a table that is not a simple one. A table with a single row or a single column of headers is simple (WCAG H63).
Why it matters
Section titled “Why it matters”In a table with headers on both axes a screen reader cannot tell whether a header belongs to the cells beside it or below it, so a cell is read with the wrong header.
To fix, add the scope that says which cells the header describes.
Example
Section titled “Example”...<form><button>go</button></form><form id="f"></form><button form="f">go</button><table><tr><th>a</th><th>b</th></tr><tr><td>1</td><td>2</td></tr></table><table><tr><th></th><th scope="col">b</th></tr><tr><th>c</th><td>2</td></tr></table>...<div aria-hidden="true"><button tabindex="-1">x</button></div></body>...Configuration
Section titled “Configuration”angular: lint: rules: header-scope: warn # off (default), warn, errorhtml: lint: rules: header-scope: warn # off (default), warn, errorsvelte: lint: rules: header-scope: warn # off (default), warn, errorvue: lint: rules: header-scope: warn # off (default), warn, errorEnabled by the presets: html/html-validate-recommended.
Suppress one line with sudsy-disable-next-line header-scope 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 | wcag/h63 |
partial | the non-strict mode only, simple tables (one header row or one header column without thead) are left alone |