scope-attr-valid
scope attribute must have a valid value
Checks that scope="..." is one of row, col, rowgroup, or colgroup.
Applies to. Applies to <th> elements with a non-empty scope attribute. HTML's table model reads scope on <th> only, and browsers ignore it elsewhere (on a <td>, or a custom element's own scope attribute).
Expectation. The scope value is one of "row", "col", "rowgroup", or "colgroup" (case-insensitive, and not trimmed: HTML matches the keyword exactly, so scope=" col " is no column header). An invalid scope value is not recognized by assistive technology, silently losing the row/column header association it was meant to declare.
What a finding reports.
value: thescopevalue as written.
These data.details fields help to read and reproduce a finding. Apart from reasonCode and the few fields Output schema names as stable, they are not a stable contract: a field may be renamed or dropped in a minor release, so don’t build on them.
Examples
<table><tr><th scope="col">Name</th></tr></table>
"col" is a valid scope value.
<table><tr><th scope="column">Name</th></tr></table>
"column" is not a valid scope value (the correct token is "col").
How to check
When this rule can’t decide, it reports cantTell and leaves the question to a person. Each question it can ask is listed here under its reason code, with the steps to answer it. A finding carries the same steps as howToCheck, in the scan’s language. See Output schema.
SCOPE_ATTR_INVALID
- Find the th the report names and read its scope value.
- Look at the table and decide whether that header labels a column or a row.
- Check that scope is exactly row, col, rowgroup or colgroup, with no extra spaces or other words.
Pass. The scope value is one of row, col, rowgroup or colgroup and matches the header's direction.
Fail. The scope value is not a recognised keyword, so it declares no header direction (best practice, H63).