Skip to content

tighten up rules for invalid use of aria-label and aria-labelledby #1334

@scottaohara

Description

@scottaohara

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 in some cases, have no corresponding ARIA role but too should be prohibited from being named by authors. The following list of 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.

Note: many of these roles already flag a warning for use of aria-label, but the message implies that if someone feels this is in error, to respond as such. These warnings, as well as other elements from the following list which are not presently flagged would need to flag an error for using these attributes without an explicit role which allows naming from authors.

Many of the following elements map to (generic) or no corresponding role - often which does not adequately support naming from author. Or, to roles which also explicitly prohibit naming from authors.

test case

  • a no href (not flagged)
  • abbr
  • address
  • area no href (not flagged)
  • b
  • bdi
  • bdo
  • body
  • caption (caption)
  • cite
  • code (code)
  • custom elements
  • data
  • del (deletion)
  • div
  • em (emphasis)
  • figcaption (caption)
  • footer (if not scoped to body) (not flagged)
  • header (if not scoped to body) (not flagged)
  • hgroup
  • i
  • ins (insertion)
  • kbd
  • label (not flagged)
  • legend
  • mark (mark)
  • p (paragraph)
  • pre
  • q
  • rt
  • s
  • samp
  • small
  • span
  • strong (strong)
  • sub (subscript)
  • sup (superscript)
  • time (time)
  • u
  • var

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions