equal-access
equal-access copied to clipboard
Rule to flag elements which are naming prohibited
With ARIA 1.2 certain roles are prohibited from being named by authors.
ARIA in HTML has identified the HTML elements which share these roles, and thus also must not be named by authors. Additional elements which have no corresponding ARIA role but also should be prohibited from being named by authors are listed as well.
Many of the following elements map to (generic
) or no corresponding role - often which does not adequately support naming from author. The elements with implicit roles which explicitly prohibit naming from authors are marked as such.
The following elements should flag an author error if aria-label
or aria-labelledby
are specified on them UNLESS a role which allows for naming is also specified.
- a no href
- abbr
- address
- area no href
- b
- bdi
- bdo
- body
- caption (
caption
) - cite
- code (
code
) - data
- del (
deletion
) - div
- em (
emphasis
) - figcaption (
caption
) - footer (if not scoped to body)
- header (if not scoped to body)
- hgroup
- i
- ins (
insertion
) - kbd
- label
- legend
- mark (
mark
) - p (
paragraph
) - pre
- q
- rt
- s
- samp
- small
- span
- strong (
strong
) - sub (
subscript
) - sup (
superscript
) - time (
time
) - u
- var
It was my understanding that aria-label can be used on text containers in order to deal with text that is not correctly understood by ATs - for instance with ASCII art. This seems like this would prevent this behavior. What is the correct pattern to deal with this then?
Do you have a spec somewhere that specifically calls out these elements?
No, that does not work consistently nor is expected for generic elements which is what the linked ARIA 1.2 specification clarifies. The elements identified here map to generic elements, or to the specific ARIA roles which explicitly prohibit naming from authors.
Your question seems to be what something like role=img aria-label=whatever
could be useful for. Or, advocating that role=text
be reconsidered for official inclusion in the ARIA specification.
Validated