Image has accessible name

  • Rule Typeatomic
  • Rule ID: 23a2a8
  • Last modified: Aug 21, 2019
  • Accessibility Requirements Mapping
    • 1.1.1 Non-text Content (Level: A)
      • Learn More about 1.1.1 (Non-text Content)
      • Required for conformance to WCAG 2.0 and above on level A and above
      • Outcome mapping:
        • Any failed outcomes: not satisfied
        • All passed outcomes: further testing is needed
        • An inapplicable outcome: further testing is needed
  • Input Aspects

Description

This rule checks that each image that is not marked as decorative, has an accessible name.

Applicability

The rule applies to HTML img elements or any HTML element with the semantic role of img that is included in the accessibility tree.

Expectation

Each target element has an accessible name that is not only whitespace, or is marked as decorative.

NOTE: An img element can be marked as decorative, by using either role="presentation", role="none" or an empty alt attribute, alt="".

Assumptions

There are currently no assumptions.

Accessibility Support

There is a known combination of a popular browser and assistive technology that does not by default support title as an accessible name.

Background

Test Cases

Passed

Passed Example 1

The HTML img element has an accessible name

<img alt="W3C logo" />

Passed Example 2

The element with role of img has an accessible name

<div role="img" aria-label="W3C logo"></div>

Passed Example 3

The element has an accessible name, though the name is not always accessibility supported

<img title="W3C logo" />

Passed Example 4

The HTML img element is marked as decorative through an empty alt attribute

<img alt="" />

Passed Example 5

The HTML img element is marked as decorative through role="presentation"

<img role="presentation" />

Passed Example 6

The HTML img element is marked as decorative through role="none"

<img role="none" />

Passed Example 7

The HTML img element has an accessible name that does not only consist of whitespace

<img alt=":-)" />

Failed

Failed Example 1

The HTML img element is not marked as decorative and does not have an accessible name

<img />

Failed Example 2

The element with role of img does not have an accessible name

<div role="img"></div>

Failed Example 3

The img element inside a div positioned off screen has no accessible name and is not marked as decorative

<div style="margin-left:-9999px;"><img /></div>

Failed Example 4

The HTML img element has an accessible name that only consist of whitespace

<img aria-label=" " />

Inapplicable

Inapplicable Example 1

The element does not have the semantic role of img

<svg xmlns="http://www.w3.org/2000/svg" role="img" width="100" height="100">
	<circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
</svg>

Inapplicable Example 2

The element has a semantic role of img, but is not included in the accessibility tree

<div role="img" aria-hidden="true"></div>

Inapplicable Example 3

HTML img element is not included in the accessibility tree

<img alt="W3C logo" aria-hidden="true" />

Inapplicable Example 4

The element is not a img element

<div aria-label="W3C logo"></div>

Glossary

Accessible Name

key: accessible-name

The programmatically determined name of a user interface element that is included in the accessibility tree.

The accessible name is calculated using the accessible name and description computation.

For native markup languages, such as HTML and SVG, additional information on how to calculate the accessible name can be found in HTML Accessibility API Mappings 1.0, Accessible Name and Description Computation (work in progress) and SVG Accessibility API Mappings, Name and Description (work in progress).

Decorative

key: decorative

Serving only an aesthetic purpose, providing no information, and having no functionality.

Note: Authors can mark an img element as decorative to indicate that it should be ignored by assistive technology by using either role="presentation", role="none", or alt="". An element should only be marked as decorative if removing the element does not cause a loss of information to the user.

Included in the accessibility tree

key: included-in-the-accessibility-tree

Elements included in the accessibility tree of platform specific accessibility APIs. Elements in the accessibility tree are exposed to assistive technologies, allowing users to interact with the elements in a way that meet the requirements of the individual user.

The general rules for when elements are included in the accessibility tree are defined in the core accessibility API mappings. For native markup languages, such as HTML and SVG, additional rules for when elements are included in the accessibility tree can be found in the HTML accessibility API mappings (work in progress) and the SVG accessibility API mappings (work in progress).

Note: Users of assistive technologies might still be able to interact with elements that are not included in the accessibility tree. An example of this is a focusable element with an aria-hidden attribute with a value of true. Such an element could still be interacted with using sequential keyboard navigation regardless of the assistive technologies used, even though the element would not be included in the accessibility tree.

Outcome

key: outcome

A conclusion that comes from evaluating an ACT Rule on a test subject or one of its constituent test target. An outcome can be one of the three following types:

  • Inapplicable: No part of the test subject matches the applicability
  • Passed: A test target meets all expectations
  • Failed: A test target does not meet all expectations

Note: A rule has one passed or failed outcome for every test target. When there are no test targets the rule has one inapplicable outcome. This means that each test subject will have one or more outcomes.

Note: Implementers using the EARL10-Schema can express the outcome with the outcome property. In addition to passed, failed and inapplicable, EARL 1.0 also defined an incomplete outcome. While this cannot be the outcome of an ACT Rule when applied in its entirety, it often happens that rules are only partially evaluated. For example, when applicability was automated, but the expectations have to be evaluated manually. Such "interim" results can be expressed with the incomplete outcome.

Semantic Role

key: semantic-role

A semantic role is a semantic association that indicates an object's type. This allows tools to present and support interaction with the object in a manner that is consistent with user expectations about other objects of that type.

The semantic role of an element is its explicit semantic role if it has any, otherwise, the implicit semantic role is used.

Whitespace

key: whitespace

Characters that have the Unicode "White_Space" property in the Unicode properties list.

This includes:

  • all characters in the Unicode Separator categories, and
  • the following characters in the Other, Control category:

    • Character tabulation (U+0009)
    • Line Feed (LF) (U+000A)
    • Line Tabulation (U+000B)
    • Form Feed (FF) (U+000C)
    • Carriage Return (CR) (U+000D)
    • Next Line (NEL) (U+0085)

Changelog

Aug 21, 2019test: add tests to verify h4 headings (#810)
Aug 21, 2019fix: update links to WCAG21 resources (#776)
Aug 21, 2019Editorial changes (#725)
Jul 26, 2019Editorial changes (#702)
Jul 19, 2019chore: run prettier (#688)
May 18, 2019chore: Validating rules frontmatter on CI (#551)
May 15, 2019Glossary and Rule update: Replacing "non-empty" definition (#430)
May 9, 2019Chore: Adapt site to ACT Rules CR format (#547)
May 7, 2019Template update - Image has accessible name (#518)
May 2, 2019chore: add manual reporting download links to rule (#492)
Apr 29, 2019chore: rename files and update associations (#489)
Apr 24, 2019Update SC1-1-1-image-has-name.md (#468)
Apr 16, 2019chore: add unique id to all rules (#478)
Apr 15, 2019chore: WCAG ACT RULES CG Website Update (#437)
Mar 26, 2019SC1-1-1-filename-is-valid-accessible-name (#263)
Feb 13, 2019Add Assumption (#418)
Dec 12, 2018Image-has-name test cases should match Applicability (#306)
Oct 12, 2018"Included in accessibility tree" instead of "exposed to assistive technologies" (#269)
Oct 10, 2018chore: Mark all SVG documents and add missing namespaces (#300)
Oct 9, 2018Fix: testcase generation (#296)
Sep 28, 2018Fix: SC1-1-1-image-has-name (#274)
Sep 20, 2018fix: tests cases
Aug 30, 2018Chore: Update test cases format and descriptions (#230)
Aug 8, 2018Rule: SC1-1-1-image-has-name (#122)
May 7, 2018Draft: SC1-1-1-non-decorative-image-accessible-name (#115)

Useful Links


Implementations

Tool NameCreated ByReport

Acknowledgements