Skip to content

hidden-focusable

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".

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).

Reported
...
<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>
angular:
lint:
rules:
hidden-focusable: warn # off (default), warn, error
html:
lint:
rules:
hidden-focusable: warn # off (default), warn, error
svelte:
lint:
rules:
hidden-focusable: warn # off (default), warn, error
vue:
lint:
rules:
hidden-focusable: warn # off (default), warn, error

Enabled 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.

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