hidden-focusable
Angular templatesHTMLVue / SvelteVue / Sveltecorrectnessno fixdefault: offhtml/html-validate-recommended
What it does
Section titled “What it does”Reports an element that can take focus (a link, a control, an element with tabindex of 0 or more) inside an element with aria-hidden="true".
Why it matters
Section titled “Why it matters”Keyboard users can still reach the element, but assistive technology does not announce it, so focus goes to something that is not there for the screen reader user.
To fix, remove aria-hidden, or make the content not focusable (tabindex="-1", disabled, inert).
Example
Section titled “Example”...<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>...<div aria-hidden="true"><button>x</button></div><div aria-hidden="true"><button tabindex="-1">x</button></div></body></html>Configuration
Section titled “Configuration”angular: lint: rules: hidden-focusable: warn # off (default), warn, errorhtml: lint: rules: hidden-focusable: warn # off (default), warn, errorsvelte: lint: rules: hidden-focusable: warn # off (default), warn, errorvue: lint: rules: hidden-focusable: warn # off (default), warn, errorEnabled by the presets: html/html-validate-recommended.
Suppress one line with sudsy-disable-next-line hidden-focusable 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 | hidden-focusable |
partial | tabindex, disabled, hiding attributes and styles of the element and its ancestors; a disabling fieldset is not looked at |