Skip to content

Clarify whether alt attribute is valid alternative text for role="img" #783

@carmacleod

Description

@carmacleod

The ARIA spec for role="img" says:

In order for elements with a role of img be perceivable, authors MUST provide alternative text or a label determined by the accessible name calculation.

My understanding is that the phrase "alternative text" in the sentence above does NOT mean that authors can go ahead and use the alt attribute to specify alternative text for any old type of element with role="img". I would think that the alt attribute is only applicable on html elements for which it is supported: <img>, <area>, and <input type="image">.

If my understanding is correct, then a div (which does not support alt) with role="img" alt="alt text" is not following the spec, i.e. there is no guarantee that screen readers will read the alt text.

I tried this with both NVDA and JAWS. Here is my test case, which has 2 divs with role="img", one with alt and one with aria-label.

  • NVDA did NOT read the alt text
  • JAWS did read the alt text
  • both read the aria-label

I would say that NVDA is following the spec, and JAWS is adding it's own heuristics.

I have seen the phrase "MUST provide alternative text" in the spec equated with "MUST provide an alt attribute" more than once now, so I think it needs to be clarified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions