text
stringlengths 153
62.8k
|
|---|
Contributions to this repository are intended to become part of Recommendation-track documents governed by the
[W3C Patent Policy](https://www.w3.org/Consortium/Patent-Policy-20040205/) and
[Document License](https://www.w3.org/Consortium/Legal/copyright-documents). To make substantive contributions to specifications, you must either participate
in the relevant W3C Working Group or make a non-member patent licensing commitment.
If you are not the sole contributor to a contribution (pull request), please identify all
contributors in the pull request comment.
To add a contributor (other than yourself, that's automatic), mark them one per line as follows:
```
+@github_username
```
If you added a contributor by mistake, you can remove them in a comment with:
```
-@github_username
```
If you are making a pull request on behalf of someone else but you had no part in designing the
feature, you can remove yourself with the above syntax.
Public comments can be made by opening a new Issue https://github.com/w3c/wcag/issues/new. The public can also comment on any issue threads on Github https://github.com/w3c/wcag/issues.
|
All documents in this Repository are licensed by contributors
under the
[W3C Document License](https://www.w3.org/Consortium/Legal/copyright-documents).
|
WCAG (Web Content Accessibility Guidelines) 2
===
This repository is used to develop content for WCAG 2, as well as associated understanding documents and techniques.
See [Onboarding for working in Github](https://www.w3.org/WAI/GL/wiki/Onboarding_for_working_in_Github)
## Editorial style guide
@@To complete
* Avoid use of RFC2119 terms such as "must", "shall", or "may" in non-normative content, to avoid confusion with normative role.
See also: [WCAG 2 Style Guide](https://github.com/w3c/wcag/wiki/WCAG-2-style-guide)
## File Structure
WCAG 2.0 was maintained in a different file structure than subsequent versions of WCAG. Source files for WCAG 2.0 are in the wcag20 folder and exists primarily for archival purposes. Do not edit content in that folder.
Content for WCAG 2.1 and later is organized according to the file structure below. The WCAG repository contains source and auxiliary files for WCAG 2, Understanding WCAG 2, and eventually techniques. It also contains auxiliary files that support automated formatting of the document. To facilitate multi-party editing, each success criterion is in a separate file, consisting of a HTML fragment that can be included into the main guidelines. Key files include:
* `guidelines/index.html` - the main guidelines file
* `guidelines/sc/{version}/*.html` - files for each success criterion
* `guidelines/terms/{version}/*.html` - files for each definition
* `understanding/{version}/*.html` - understanding files for each success criterion
* `wcag20/` was used by a previous version of WCAG, so anything ending .xml is no longer used, *do not update*.
Where `{version}` is "20", content came from WCAG 2.0. "21" is used for content introduced in WCAG 2.1, "22" for WCAG 2.2, etc.
## Build System
The Techniques and Understanding documents are processed through a build system based on Eleventy and Liquid for templating and Cheerio for transformations.
More details, including instructions for previewing the output locally, can be found in the [build process README](11ty/README.md).
## Editing Draft Success Criteria
[Success Criteria Managers](https://www.w3.org/WAI/GL/wiki/SC_Managers_Phase1) will prepare candidate success criteria, ready for inclusion in the guidelines document. To prepare success criteria, follow these steps:
1. [Clone the repository](https://help.github.com/articles/cloning-a-repository/), using the URI https://github.com/w3c/wcag.git to clone.
1. Switch to the working branch for the proposal, which is named for the shortname of the draft success criterion and the issue number, concatenated together.
1. Find the appropriate file for the success criterion in the guidelines/sc/21 folder, named the same as the start of the branch name, and open in an HTML-capable editor. Do the same with any definitions referenced by the success criterion, in the guidelines/terms/21 folder.
1. Open the guidelines/index.html file and remove comment marks around the lines that reference the success criterion and terms you have edited..
1. Follow the [success criteria format](#user-content-success-criteria-format) below to create the SC content.
1. Save the file and commit the change. NOTE: It is important to also add a suitable 'commit message'. In the comments, reference the issue number from which the proposal was developed starting with a hash, e.g., `#1`.
1. When the success criterion is ready for Working Group review, inform the chairs. Once the proposal has been accepted by the Working Group, the editors will merge the working branch into the main branch, which puts it in the editors' draft and eventual Technical Report publication.
### Success Criteria Format
Success criteria use a simple structure of HTML elements, with a few class attribute values, to ensure consistency. Enhancement scripts and style key off this structure. Content you provide is indicated in braces. Items after comments are optional.
```html
<section class="sc">
<h4>{SC Handle}</h4>
<p class="conformance-level">{Level}</p>
<p class="change">{Change}</p>
<p>{Main SC Text}</p>
<!-- if SC has sub-points -->
<dl>
<dt>{Point Handle}</dt>
<dd>{Point Text}</dd>
</dl>
<!-- if SC has notes -->
<p class="note">{Note}</p>
</section>
```
Note you do not provide the SC number. Numbers will be assigned, and most likely automatically generated, later.
Values you provide are described below. Refer to [Success Criterion 2.2.1](https://www.w3.org/TR/WCAG20/#time-limits-required-behaviors) for an example of each of these pieces of content.
<dl>
<dt>{SC Handle}</dt>
<dd>The short name of the SC. In SC 2.2.1 this is "Timing Adjustable".</dd>
<dt>{Level}</dt>
<dd>The conformance level of the SC. Values can be "A", "AA", or "AAA". Do not include the word "Level".</dd>
<dt>{Change}</dt>
<dd>Indicate whether the SC is unchanged from WCAG 2.0, changed, or new. Values can be "Unchanged", "Changed", or "New".</dd>
<dt>{Main SC Text}</dt>
<dd>The main text of the SC, or the starting paragraph. In SC 2.2.1 this is the content that begins "For each time limit...".</dd>
<dt>{Point Handle}</dt>
<dd>If the SC has bullets, each bullet has a handle. In SC 2.2.1 the first bullet point handle is "Turn off".</dd>
<dt>{Point Text}</dt>
<dd>The content of the bullet. In SC 2.2.1 the first bullet point text begins "The user is allowed...".</dd>
<dt>{Note}</dt>
<dd>If there is a note to the SC, provide it after the other content (without the starter "Note"). In SC 2.2.1, this is the content that begins "This success criterion...". If there is more than one note, multiple `<p class="note">`elements may be provided.</dd>
</dl>
### Definitions
If you are providing term definitions along with your SC, include them in the respective `guidelines/terms/{version}` directory, one-per-file, using the following format:
```html
<dt><dfn id="dfn-{shortname}">{Term}</dfn></dt>
<dd>{Definition}</dd>
```
The `dfn` element tells the script that this is a term and causes special styling and linking features. To link to a term, use an `<a>` element without an `href` attribute; if the link text is the same as the term, the link will be correctly generated. For example, if there is a term `<dfn>web page</dfn>` on the page, a link in the form of `<a>web page</a>` will result in a proper link.
If the link text has a different form from the canonical term, e.g., "web pages" (note the plural), you can provide a hint on the term definition with the `data-lt` attribute. In this example, modify the term to be `<dfn data-lt="web pages">web page</dfn>`. Multiple alternate names for the term can be separated with pipe characters, with no leading or trailing space, e.g., `<dfn data-lt="web pages|page|pages">web page</dfn>`.
## Editing Draft Understanding Content
There is one Understanding file per success criterion, plus an index:
* `understanding/index.html` - index page, need to uncomment or add a reference to individual Understanding pages as they are made available
* `understanding/{version}/*.html` - files for each understanding page, named the same as the success criterion file in the guidelines
Files are populated with a template that provides the expected structure. Leave the template structure in place, and add content as appropriate within the sections. Elements with class="instructions" provide guidance about what content to include in that section; you can remove those elements if you want but don't have to. The template for examples proposes either a bullet list or a series of sub-sections, choose one of those approaches and remove the other from the template.
Note that associated techniques are no longer defined within each understanding page; they are now defined in the `associatedTechniques` field in `understanding/understanding.11tydata.js`. See [Associated Techniques Data](11ty/README.md#associated-techniques-data) for more information.
Understanding files are referenced from the relevant Success Criterion on the WCAG specification; these links are put in by the script.
The formal publication location for Understanding pages is currently https://www.w3.org/WAI/WCAG22/Understanding/. This content is updated as needed; and may be automated.
## Editing Techniques
Techniques are in the techniques folder, and grouped by technology into sub-folders. Each technique is a standalone file, which is in HTML format with a regular structure of elements, classes, and ids.
### Technique File Structure
The [technique template](techniques/technique-template.html) shows the structure of techniques. Main sections are in top-level <section> elements with specific IDs: meta, applicability, description, examples, tests, related, resources. The description and tests sections are required; the applicability and examples sections are recommended; the related and resources sections are optional. The meta section provides context for the technique during authoring but is removed for publication. The title of the technique is in the `<h1>` element. Elements with `class="instructions"` provide information about populating the template. They should be removed as the technique is developed but if not removed, will be ignored by the generator. **Do not copy `class="instructions"` on real content.**
Techniques can use a temporary style sheet to facilitate review of drafts. This style sheet is replaced by other style sheets and structure for formal publication. To use this style sheet, add `<link rel="stylesheet" type="text/css" href="../../css/editors.css"/>` to the head of the technique.
### Images, Examples, Cross References for Techniques
Techniques can include images. Place the image file in the `img` folder of the relevant technology - meaning all techniques for a technology share a common set of images. Use a relative link to load the image. Most images should be loaded with a `<figure>` element and labeled with a `<figcaption>` positioned at the bottom of the figure. `<figure>` elements must have an `id` attribute. Small inline images may be loaded with a `<img>` element with suitable `alt` text.
Techniques should include brief code examples to demonstrate how to author content that follows the technique. Code examples should be easy to read, and usually not complete content in themselves. More complete examples can be provided as [working examples](#user-content-provide-working-examples-of-techniques) (see below). Link to working examples at the bottom of each example, in a `<p class="working-example">` element, containing a relative link to `../../working-examples/{example-name}/`.
Cross references to other techniques may be provided where useful. Generally they should be provided in the "Related Techniques" section but can be provided elsewhere. Use a relative link to reference the technique, `{Technique ID}` if the same technology, or `../{Technology}/{Technique ID}` otherwise. If the technique is still under development and does not have a formal ID, reference the path to the development file. If the technique is under development in a different branch, use an absolute URI to the rawgit version of the technique.
Cross references to guidelines and success criteria should use a relative URI to the *Understanding* page for that item. Cross references to other parts of the guidelines should use an absolute URI to the guidelines as published on the W3C TR page, a URI beginning with `https://www.w3.org/TR/WCAG22/#`. Note that references to guidelines or success criteria to which techniques relate are added by the generator upon publication based on information in the Understanding documents, so redundant links to those is not normally needed or advised.
### Create Techniques
[General priorities and process to work on techniques are maintained in the wiki](https://www.w3.org/WAI/GL/wiki/Wcag21-techniques).
New techniques should use a filename that is derived from a shortened version of the technique title. Editors will assign the technique an ID and rename the file when it is accepted by the Working Group. For example, a technique "Using the alt attribute on the img element to provide short text alternatives" might use "img-alt-short-text-alternatives.html" as the filename. The editors will assign it a formal ID, and rename the file, when it is accepted by the Working Group.
Each new technique should be created in a new branch. Set-up of the branch and file is automated via the create-techniques.sh script, which can be run with bash. The command line is:
```
bash create-techniques.sh <technology> <filename> <type> "<title>"
```
* `<technology>` is the technology directory for the technique
* `<filename>` is the temporary filename (without extension) for the technique
* `<type>` is "technique" or "failure"
* `<title>` is the title of the technique, enclosed in quotes and escaping special characters with \\
This automates the following steps:
* Determine a filename for the technique that is likely to be descriptive, unique, and short.
* Create a working branch named the same as the technique filename.
* Copy the techniques/technique-template.html file into the appropriate technology folder for the technique, and give it the chosen file name.
* In the section element with id "meta", indicate to which guideline or success criterion the technique relates, and whether the technique is sufficient, advisory, or a failure for that item. Multiple applicability are allowed.
Once a technique branch and file is set up, populate the content and request review:
* Populate the template with appropriate content, using other techniques as examples for code formatting choices. Keep the existing structural sections from the template in place.
* When the technique is ready for review, make a pull request into the main branch.
* If you wish to reference the draft technique from an Understanding document, use the technique's rawgit URI.
* After a technique is approved, the chairs will assign it an ID and update links to it in the Understanding documents.
### Formatting Techniques
Techniques in the repository are plain HTML files with minimal formatting. For publication to the editors' draft and W3C location, techniques are formatted by the Eleventy build process described above in the [Build System section](#build-system).
The generator compiles the techniques together as a suite with formatting and navigation. It enforces certain structures, such as ordering top-level sections described above and standardizing headings. It attempts to process cross reference links to make sure the URIs work upon publication. One of the most substantial roles is to populate the Applicability section with references to the guidelines or success criteria to which the technique relates. The information for this comes from the Understanding documents. Proper use of the technique template is important to enable this functionality, and mal-formed techniques may cause the generator to fail.
### Obsolete Techniques
Obsolete techniques should not be removed from the repository. Instead, they can be marked using YAML front-matter. For example:
```yaml
---
obsoleteSince: 22
obsoleteMessage: |
This failure relates to 4.1.1: Parsing, which was removed as of WCAG 2.2.
---
```
* `obsoleteSince` indicates the earliest version of WCAG 2 when the technique became obsolete
(this may be set to `20` if it should effectively be obsolete for all versions, e.g. for
techniques involving deprecated HTML elements)
* `obsoleteMessage` indicates a message to be displayed within the About this Technique section
In cases where entire technologies are obsolete (e.g. Flash and Silverlight), these properties may also be specified at the technique subdirectory level, e.g. via `techniques/flash/flash.11tydata.json`.
Note that this case specifically requires JSON format, as this is consumed by both Eleventy and additional code in the build process used to assemble techniques data.
## Spell-checking
Both the normative and informative content is checked for spelling errors using [cspell](https://cspell.org/). This check runs on pull requests, and can be run locally via `npm run cspell` (requires [Node.js](https://nodejs.org/); remember to run `npm i` first if you haven't recently).
### Adding valid words
If a word is flagged that should be allowed anywhere it appears, add a line to the top-level `custom-words.txt` file, ideally under the appropriate section in alphabetical order.
If a word is flagged that should be allowed in a specific file, but should be considered incorrect elsewhere, add an entry to the `overrides` list in the top-level `cspell.yml` file. (Several examples already exist for reference.)
Note that both inline code and code blocks are ignored, so if you are using a term that pertains to a specific language/syntax, consider enclosing it in `<code>` or `<pre>` as appropriate.
## Version-specific Documentation
Informative documents are generated from the same source files for both WCAG 2.2 and 2.1,
as most of their content is consistent between them. (The guidelines themselves continue to be
maintained on separate branches e.g. `WCAG-2.1`, for purposes of maintaining separate Editors' Drafts.)
When building informative documents for older versions, the build system prunes success criteria that are
specific to newer versions, and in turn any techniques that are exclusively related to those criteria.
There are a few cases where content may need to cater to a specific version, explained in this section.
### Specifying Precise Version Number within Informative Documents
**Note:** This is _only_ applicable within `techniques` and `understanding` folders (_not_ `guidelines`).
In cases where the precise version number should be displayed within informative documents,
insert `{{ versionDecimal }}`. This will be replaced with the decimal-point-delimited version number,
e.g. 2.1 or 2.2.
### "New in {version}" Call-outs
In cases where a document pertaining to multiple versions warrants a specific call-out about an update in
a newer version, `class="wcagXY"` can be applied to an element surrounding the prose in question
(e.g. `class="wcag22"` for WCAG 2.2). This will result in the prose being omitted from earlier versions,
and displayed with the prefix "New in WCAG X.Y: " in applicable versions.
This class can also be applied alongside the `note` class, in which case " (New in WCAG X.Y)" will be
appended to the "Note" title in applicable versions, and the note will be hidden in earlier versions.
### Techniques Change Log
Data for the Techniques Change Log is now generated automatically by a script that reads git history;
see [Eleventy Usage](11ty/README.md#usage).
## Working Examples
Examples in techniques should be brief easy-to-consume code samples of how the technique is used in content. Therefore examples should focus on the specific features the technique describes, and not include related content such as style, script, surrounding web content, etc.
Often it is desirable to provide more comprehensive examples, which show the technique in action while not interfering with the main technique document. These examples also show the complete code required to make the technique operate, including full style and script files, images, page code, etc. Usually, these "working examples" are referenced at the bottom of the elided example which is included in the main technique.
Working examples are stored in the `working-examples` directory of the repository. Each example is in its own subdirectory, to contain the multiple files that may be necessary to make the example work. In some cases, multiple working examples will share common resources; these are stored in the appropriate sub-directory of the working-examples directory, e.g., `working-examples/css`, `working-examples/img`, `working-examples/script`. Reference these common resources when available; otherwise place resources in the working example directory, using subdirectories to organize when appropriate.
To create a working example:
* Identify the name for the example, e.g., "Using the alt attribute".
* Create a working branch for the example, whose name begins with the prefix `example-` and which otherwise semantically identifies the example, e.g., `example-alt-attribute`.
* Create a directory for the example inside the working examples directory, using the semantic name for the example minus the prefix used in the branch name, e.g., `working-examples/alt-attribute/`.
* If the primary example is HTML, name the file `index.html`. Otherwise, create a suitable file name.
* Refer to resources shared among multiple examples using relative links, e.g., `../css/example.css`. Place other resources in the same directory as the main example, e.g., `working-examples/alt-attribute/css/alt.css`.
* Reference working examples from techniques using the rawgit URI to the example in its development branch, e.g., `https://rawgit.com/w3c/wcag/main/working-examples/alt-attribute/`. Editors will update links when examples are approved.
* When the example is complete and functional, submit a pull request into the main branch.
## Errata
The errata documents for WCAG 2.1 and 2.2 are now maintained in this repository.
See the [Errata README](errata/README.md) for authoring details.
**Note:** The errata for both versions are maintained on the `main` branch for use in builds.
Direct edits to the guidelines for WCAG 2.1 must be performed under `guidelines/` on the `WCAG-2.1` branch.
## Translations
WCAG 2.2 is ready for translation. To translate WCAG 2.2, follow instructions at [How to Translate WCAG 2](https://www.w3.org/WAI/about/translating/wcag/).
|
# Code of Conduct
All documentation, code and communication under this repository are covered by the [W3C Code of Ethics and Professional Conduct](https://www.w3.org/Consortium/cepc/).
|
# Errata Editing Instructions
Errata are listed in reverse-chronological order, first sectioned by publish date,
then within each section based on when each erratum was added.
## Sections
The first top-level section under `<main>` corresponds to the latest version / unpinned URL;
subsequent sections correspond to previous versions / date-stamped URLs.
Each top-level section should be preceded by `trDate` and `trUrl` variable assignments.
These variables reduce the chance of copy-paste errors within individual errata.
For sections corresponding to previous versions, assignments should follow this pattern
(only `YYYY-MM-DD` should need to be replaced):
```
{%- assign trDate = "YYYY-MM-DD" -%}
{%- capture trUrl -%}
https://www.w3.org/TR/{{ trDate | split: "-" | first }}/REC-WCAG{{ page.fileSlug }}-{{ trDate | replace: "-", "" }}/
{%- endcapture -%}
```
The level 2 heading in the top-level section for each previous version should use this code
(no replacements necessary, making use of the preceding variable reassignments):
```html
<h2>Errata since <a href="{{ trUrl }}">{{ trDate | date: "%d %B %Y" }} Publication</a></h2>
```
## Erratum format
Each erratum should be in the following format
(replacing `YYYY-MM-DD`, `Section Title`, `sectionid`, `details of changes`, and `#NNNN`):
```html
<li>
YYYY-MM-DD:
In <a href="{{ trUrl }}#sectionid">Section Title</a>,
details of changes.
({% gh #NNNN %})
</li>
```
Adhering to this format is important, as any entries under the latest published version will also be
parsed for inclusion within Guideline/SC boxes and Key Terms definitions within Understanding pages.
(Newlines are insignificant and are suggested for source code readability.)
Each piece of this format is further explained in the subsections below.
### Section reference
When applicable, errata should begin with an indication of the section they relate to, including a link.
Example phrasing when linking to a section, e.g. a success criterion:
```html
In <a href="{{ trUrl }}#target-size-minimum">2.5.8 Target Size (Minimum)</a>
```
Example phrasing when linking to a term definition:
```html
In the definition for <a href="{{ trUrl }}#dfn-single-pointer">single pointer</a>
```
(Remember that term definition fragments always begin with `dfn-`.)
It is possible to reference multiple sections/terms from one erratum,
so long as all of the links remain front-loaded prior to the erratum's details.
### Details of changes
`details of what happened` should be expressed in present progressive tense
(e.g. "updating", "removing", "adding"), with the desired outcome listed first.
For example:
- updating the red threshold from ... to ...
- removing one note and adding two new notes, including ...
- removing a supernumerary "Note" indicator from the first note.
- correcting the word ... to ...
### GitHub PR or commit
When possible, provide a reference to one or more GitHub pull requests or commit hashes
at the end of each erratum, in the format `({% gh "..." %})`.
The format breaks down as follows:
- `{% gh "..." %}` is a custom shortcode, which accepts one of the following:
- A PR number prefixed with `#`, e.g. `"#4080"` (this is the preferred option when available)
- A commit hash of 7 or more characters, with no prefix, e.g. `"b043430"`
- The quotes around the parameter passed to the `gh` shortcode are necessary for template parsing
- The outer parentheses exist only for punctuation, and are directly output
|
# Eleventy Infrastructure for WCAG Techniques and Understanding
This subdirectory contains ES Modules re-implementing pieces of the
XSLT-based build process using Eleventy.
## Usage
Make sure you have Node.js installed. This has primarily been tested with v20,
the current LTS at time of writing.
If you use [`fnm`](https://github.com/Schniz/fnm) or [`nvm`](https://github.com/nvm-sh/nvm) to manage multiple Node.js versions,
you can switch to the recommended version by typing `fnm use` or `nvm use`
(with no additional arguments) while in the repository directory.
Otherwise, you can download an installer from [nodejs.org](https://nodejs.org/).
First, run `npm i` in the root directory of the repository to install dependencies.
Common tasks:
- `npm run build` runs a one-time build
- `npm start` runs a local server with hot-reloading to preview changes as you make them:
- http://localhost:8080/techniques
- http://localhost:8080/understanding
Maintenance tasks (for working with Eleventy config and supporting files used by the build):
- `npm run check` checks for TypeScript errors
- `npm run fmt` formats all TypeScript files
## Publishing to WAI website
The following npm scripts can be used to assist with publishing updates to the WAI website:
- `npm run publish-w3c` to publish 2.2
- `npm run publish-w3c:21` to publish 2.1
Each of these scripts performs the following steps:
1. Updates the data used for the Techniques Change Log page
- Note that this step may result in changes to `techniques/changelog.11tydata.json`, which should be committed to `main`
2. Runs the build for the appropriate WCAG version, generating pages and `wcag.json` under `_site`
3. Copies the built files from `_site` to the CVS checkout (see [`WCAG_CVSDIR`](#wcag_cvsdir))
## Associated Techniques Data
Each success criterion's page contains a Techniques section which links to associated techniques.
These used to be defined directly in HTML in each respective page, but have since been relocated to
a single data file, `understanding/understanding.11tydata.js`, under the key `associatedTechniques`.
This field is typed, in order to provide some degree of autocomplete in IDEs that support TypeScript
(e.g. Visual Studio Code), as well as some amount of immediate feedback while editing.
Further validation is performed when running the build or dev server, to provide more focused error messages for common mistakes.
### Listing Techniques
Techniques may be indicated via an object as outlined below, or using a shorthand string.
Shorthand strings may function as either `id` or `title` seen below, and are
recommended for brevity when no `using` or `and` relationship is present.
The following list outlines properties available on each technique object:
- `id` - Technique ID
- `title` - Technique description (HTML flow content allowed), to define free-form entries that don't reference a specific technique
- `using` - Optional array of further techniques to be populated into a child list
- Child techniques may also include `using`
- `usingConjunction` - When `using` is specified, this overrides the word that appears before `usingQuantity`
- Default: `"using"`; HTML flow content allowed
- `usingQuantity` - When `using` is specified, this overrides the word that appears after `usingConjunction` and before "of the following techniques"
- Default: `"one"`
- May be empty string (`""`), in which case the subsequent "of" is dropped
- `usingPrefix` - Adds text to appear before `usingConjunction`
- `skipUsingPhrase` - Omits the entire "... using ... of the following techniques" phrase
- This is mainly an escape hatch for rare instances where a child list is used but no "using" phrase appears at all (e.g. in 1.4.4: Resize Text)
Typically, either `id` or `title` is required.
If `id` is specified, then `prefix` and/or `suffix` may also be specified (with HTML flow content allowed in each),
resulting in "{prefix} {linked technique title} {suffix}".
In extremely rare cases, `using` may be specified alone without either `id` or `title`,
e.g. for top-level "Using two or more of the following" in 2.4.5: Multiple Ways.
#### Conjunctions
To represent multiple parallel techniques, an `and` key may be specified instead of `id` or `title`. In this case, the following properties are supported:
- `and` - an array of technique objects or shorthand strings (as described above)
- `using` and its related fields (seen above) may optionally be specified alongside `and`
- `andConjunction` may optionally be specified alongside `and`,
to override the default `"<strong>AND</strong>"` phrasing (e.g. in 4.1.3: Status Messages)
- Techniques listed _within_ `and` should be flat, never containing `and` or `using`
### Situations or Other Subsections (Sufficient only)
The top level of the `sufficient` array may consist entirely of either technique entries (see above)
or subsection entries. It should not contain a mix of both.
Subsections are typically used to define multiple "situations", where each title begins with "Situation A:", "Situation B:", etc.;
in rare cases it is used for other purposes, e.g. in 1.4.8: Visual Presentation.
Subsection entries contain the following:
- `title` (required, HTML allowed)
- `techniques` (required) - array of technique entries (see above)
- `note` (optional, HTML allowed) - content to appear in a Note at the end of the subsection (e.g. in 4.1.3: Status Messages)
- `groups` (optional) - array of objects with `id`, `title`, `techniques`; see more below
- `techniques` within `groups` are not expected to involve `and` or `using`
#### Groups within Situations
Most of the situations in 1.1.1: Non-text Content include groupings which start with a boldface paragraph (not a heading),
and are referenced one or more times within preceding "using" clauses.
Groups can be defined at the top level of each situation/section entry as mentioned above.
Defining `groups` automatically implies a "using" relationship, without explicitly defining `using` for each technique.
## Environment Variables
### `WCAG_CVSDIR`
**Usage context:** `publish-w3c` script only
Indicates top-level path of W3C CVS checkout, for WAI site updates (via `publish-w3c` script).
**Default:** `../../../w3ccvs` (same as in Ant/XSLT build process)
### `WCAG_VERBOSE`
**Usage context:** Local development, debugging
Prints more log messages that are typically noisy and uninteresting,
but may be useful if you're not seeing what you expect in the output files.
**Default:** Unset (set to any non-empty value to enable)
### `WCAG_VERSION`
**Usage context:** for building informative docs pinned to a publication version
Indicates WCAG version being built, in `XY` format (i.e. no `.`).
Influences which pages get included, guideline/SC content,
and a few details within pages (e.g. titles/URLs, "New in ..." content).
Also influences base URLs for links to guidelines, techniques, and understanding pages.
Explicitly setting this causes the build to reference guidelines and acknowledgements
published under `w3.org/TR/WCAG{version}`, rather than using the local checkout
(which is effectively the 2.2 Editors' Draft). Note this behavior can be further
altered by `WCAG_FORCE_LOCAL_GUIDELINES`.
Possible values: `22`, `21`
### `WCAG_FORCE_LOCAL_GUIDELINES`
**Usage context:** Only applicable when `WCAG_VERSION` is also set;
should not need to be set manually
When building against a fixed publication version, this overrides the behavior of
loading data from published guidelines, to instead load an alternative local
`guidelines/index.html` (e.g. from a separate git checkout of another branch).
This was implemented to enable preview builds of pull requests targeting the
`WCAG-2.1` branch while reusing the existing build process from `main`.
Possible values: A path relative to the project root, e.g. `../guidelines/index.html`
### `WCAG_MODE`
**Usage context:** should not need to be set manually except in specific testing scenarios
Influences base URLs for links to guidelines, techniques, and understanding pages.
Typically set by specific npm scripts or CI processes.
Note that setting `WCAG_MODE` to any non-empty value (even one not listed below) will also result
in page footers referencing last modified times based on git, rather than the local filesystem.
Possible values:
- Unset **(default)** - Sets base URLs appropriate for local testing
- `editors` - Sets base URLs appropriate for `gh-pages` publishing; used by deploy action
- `publication` - Sets base URLs appropriate for WAI site publishing; used by `publish-w3c` script
### `WCAG_JSON`
Generates `_site/wcag.json`. (This is not done by default, as it adds to build time.)
**Default:** Unset by default; `publish-w3c` scripts set this to a non-empty value.
For more information on the output, see [11ty/json/README.md](json#readme).
### `GITHUB_REPOSITORY`
**Usage context:** Automatically set during GitHub workflows; should not need to be set manually
Influences base URLs for links to guidelines, techniques, and understanding pages,
when `WCAG_MODE=editors` is also set.
**Default:** `w3c/wcag`
## Other points of interest
- The main configuration can be found in top-level `eleventy.config.ts`
- Build commands are defined in top-level `package.json` under `scripts`,
and can be run via `npm run <name>`
- If you see files named `*.11tydata.*`, these contribute data to the Eleventy build
(see Template and Directory Data files under
[Sources of Data](https://www.11ty.dev/docs/data/#sources-of-data))
|
# JSON Serialization of WCAG 2
The script in this folder serializes WCAG 2 information into JSON format, including:
- Principles, guidelines, and success criteria
- Glossary terms
- Associations between (normative) success criteria and (informative) techniques
The following JSON files are published monthly:
- [WCAG 2.2 JSON](https://www.w3.org/WAI/WCAG22/wcag.json)
- [WCAG 2.1 JSON](https://www.w3.org/WAI/WCAG21/wcag.json)
For a history of structural changes to the JSON files, see the [list of merged wcag.json pull requests](https://github.com/w3c/wcag/pulls?q=is%3Apr+label%3Awcag.json), and in particular the "wcag.json Changes" section in each pull request description.
## Permission to use with attribution
You may use this data, in full or in part, provided you:
- Clearly attribute the original source and include a link to it ([Web Content Accessibility Guidelines (WCAG) 2.2](https://www.w3.org/TR/WCAG22/), [Techniques for WCAG 2.2](https://www.w3.org/WAI/WCAG22/Techniques/), [Web Content Accessibility Guidelines (WCAG) 2.1](https://www.w3.org/TR/WCAG21/), [Techniques for WCAG 2.1](https://www.w3.org/WAI/WCAG21/Techniques/))
- Do not change the content
If you include additional information, it must be clear what is from the W3C WCAG documents and what is added.
See [W3C Document license](https://www.w3.org/copyright/document-license/) and [W3C Intellectual rights](https://www.w3.org/copyright/intellectual-rights/), particularly '[May I annotate one of your specifications?](https://www.w3.org/copyright/intellectual-rights/#annotate)'.
|
---
title: Accessibility guides
short-title: Guides
slug: Web/Accessibility/Guides
page-type: listing-page
sidebar: accessibilitysidebar
---
This page lists guides for web accessibility.
They're intended to help you understand what kinds of things are possible to improve the accessibility of your projects on the web.
{{SubPagesWithSummaries}}
|
---
title: Accessibility and spatial patterns
short-title: Spatial patterns
slug: Web/Accessibility/Guides/Accessibility_and_Spatial_Patterns
page-type: guide
sidebar: accessibilitysidebar
---
This document describes visual patterns that can induce physical symptoms in people who have photosensitive epilepsy, vestibular disorders, or other perceptual issues.
## Spatial Localization
NASA conducted research on the perception of color, and found that luminance contrast mattered greatly as to how colors are perceived. The two images below are from NASA research, specifically, from the article, "[Designing With Blue](https://web.archive.org/web/20250216024807/https://colorusage.arc.nasa.gov/blue_2.php)"
 
> **Spatial Localization.** Symbols which have the same luminance as their background are perceptually less securely located in space and time than are symbols with higher luminance contrast. They tend to "float" visually or be "captured" by adjacent symbols with high luminance-contrast. The phenomenon seems to be especially problematic for symbol/background combinations that differ only in the blue channel.
## Distance between stripes
Photosensitive seizures may be caused by static images as well as animation. The mechanism for this is poorly understood, but is believed to be linked to "gamma oscillations" set up in the brain. These oscillations in the brain are a different kind of response than other kinds of neurological responses believed to cause photosensitive seizures.
Stripes and patterns are typical of the kinds of images that create problems, and stripes have been studied most closely. There's the potential for causing harm if there are more than five light-dark pairs of stripes in any orientation. They can be parallel, radial, curved or straight, and may be formed by rows of repeating elements.
In 2005, Arnold Wilkins, John Emmett, and Graham Harding evaluated the guidelines for characterizing patterned images that could precipitate seizures. They revised the guidelines to their fundamental core, and came up with a surprisingly simple, but powerful [test](https://onlinelibrary.wiley.com/doi/full/10.1111/j.1528-1167.2005.01405.x), which they published in the paper, **[Characterizing the Patterned Images That Precipitate Seizures and Optimizing Guidelines To Prevent Them](https://onlinelibrary.wiley.com/doi/full/10.1111/j.1528-1167.2005.01405.x)**
> [!NOTE]
> The steps necessary to evaluate material reduce to the following:
>
> Look at the screen:
>
> - Are there more than five stripes?
> - If so, do they last longer than 0.5 s?
> - If so, does the brightness exceed the stated limit?
> - If so, categorize the motion of the pattern.
> - Are the guidelines contravened?
>
> If so, reduce brightness.
## Text and padding
WCAG standards for contrast perception do not take into account the effect of padding. For example, blue text on a gray background is easier to perceive if it is surrounded "locally" by black than by white. There is such a thing as "local" adaptation to colors. The bottom line: padding matters.
## Math
Spatial reasoning affects Math learning; consequently, spatial relationships in how math is presented affects cognition. The web developer can do something about this in the manner in which they display math. Animation figures strongly in this arena. For example, "how" an object looks when it is rotated, from different angles, how they look sliced, and how they relate to each other in space all make a difference in an ability to understand Math in spatial terms.
## Braille
Modern technology enables non-experts to print Braille. Adobe Illustrator, for example, allows one to Typeset ADA Braille for printing out.
The ability to represent spatial patterns accurate to those who are blind is critical for accessibility. For example, knowing Braille is not enough. The Braille dots have to be spatially apart from one another so as to be readable in a "human" way. The human touch does distinguish with ease braille dots that are too close or too far apart from one another.
Space has to surround the braille character. A user of braille does not lay a finger on "top" of a braille character, the user has to move her finger over the character, in the way that a sighted person must move her eyes across text written on a page.
The nature of space can change depending upon what MIME type is being used, and its version. For example, borders on SVG can extend both inward and outward from its dimensions, or for newer versions of SVG, entirely outward from it, thus reducing the space around the SVG to enable perception.
## See also
### MDN
- [Accessibility: What users can do to browse more safely](/en-US/docs/Web/Accessibility/Guides/Browsing_safely)
- [Web accessibility for seizures and physical reactions](/en-US/docs/Web/Accessibility/Guides/Seizure_disorders)
- [Web Accessibility: Understanding Colors and Luminance](/en-US/docs/Web/Accessibility/Guides/Colors_and_Luminance)
### Braille
- [Part 3: A Step-by-Step Guide to Typesetting ADA Braille Correctly in Adobe Illustrator](https://www.tinkeringmonkey.com/guides/ada-signage/a-step-by-step-guide-to-typesetting-ada-braille-correctly-in-adobe-illustrator/)
- [Spatial Math in BrailleBlaster (4 of 5)](https://www.youtube.com/watch?v=yz9vefDsj1g)
### Math
- [Spatial Reasoning: Why Math Talk is About More Than Numbers](https://dreme.stanford.edu/news/spatial-reasoning-why-math-talk-is-about-more-than-numbers/)
### Scientific Literature
- [Color constancy in context: Roles for local adaptation and levels of reference](https://jov.arvojournals.org/article.aspx?articleid=2192799)
- [Gamma oscillations and photosensitive epilepsy](https://www.sciencedirect.com/science/article/pii/S0960982217304062?via%3Dihub)
- [Characterizing the Patterned Images That Precipitate Seizures and Optimizing Guidelines To Prevent Them](https://onlinelibrary.wiley.com/doi/epdf/10.1111/j.1528-1167.2005.01405.x) Arnold Wilkins, John Emmett, and Graham Harding
|
---
title: Mobile accessibility checklist
slug: Web/Accessibility/Guides/Mobile_accessibility_checklist
page-type: guide
sidebar: accessibilitysidebar
---
This document provides a concise checklist of accessibility requirements for mobile app developers. It is intended to continuously evolve as more patterns arise.
## Color
- Color contrast must comply with [WCAG 2.2 AA level requirements](https://w3c.github.io/wcag/guidelines/22/#contrast-minimum):
- Contrast ratio of 4.5:1 for normal text (less than 18 point or 14 point bold.)
- Contrast ratio of 3:1 for large text (at least 18 point or 14 point bold.)
- Information conveyed via color must be also available by other means too (underlined text for links, etc.)
## Visibility
- Content hiding techniques such as zero opacity, z-index order and off-screen placement must not be used exclusively to handle visibility.
- Everything other than the currently visible screen must be _truly_ invisible (especially relevant for single page apps with multiple _cards_):
- Use the `hidden` attribute or `visibility` or `display` style properties.
- Unless absolutely unavoidable, `aria-hidden` attribute should not be used.
## Focus
- All activatable elements must be focusable:
- Standard controls such as links, buttons, and form fields are focusable by default.
- Non-standard controls must have an appropriate [ARIA Role](/en-US/docs/Web/Accessibility/ARIA/Reference/Roles) assigned to them, such as `button`, `link`, or `checkbox`.
- Focus should be handled in a logical order and consistent manner.
## Text equivalents
- Text equivalent must be provided for every non-strictly presentational non-text element within the app.
- Use _alt_ and _title_ where appropriate (read Steve Faulkner's post about [Using the HTML title attribute](https://www.tpgi.com/using-the-html-title-attribute-updated/) for a good guide.)
- If the above attributes are not applicable, use appropriate [ARIA States and Properties](/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes) such as `aria-label`, `aria-labelledby`, or `aria-describedby`.
- Images of text must be avoided.
- All user interface components with visible text (or image of text) as labels must have the same text available in the programmatic [name](https://w3c.github.io/wcag/guidelines/22/#dfn-name) of the component. [WCAG 2.1: Label in name.](https://www.w3.org/WAI/WCAG21/Understanding/label-in-name.html)
- All form controls must have labels ({{ htmlelement("label") }} elements) for the benefit of screen reader users.
## Handling state
- Standard controls such as radio buttons and checkboxes are handled by the operating system. However, for other custom controls state changes must be provided via [ARIA States](https://w3c.github.io/aria/#state_prop_def) such as `aria-checked`, `aria-disabled`, `aria-selected`, `aria-expanded`, and `aria-pressed`.
## Orientation
- Content should not be restricted to a single orientation, such as portrait or landscape, unless essential. [WCAG 2.1: Orientation](https://www.w3.org/WAI/WCAG21/Understanding/orientation.html)
- Examples of when an orientation is essential is a piano application or a bank check.
## General guidelines
- An app title must be provided.
- Headings must not break hierarchical structure
```html
<h1>Top level heading</h1>
<h2>Secondary heading</h2>
<h2>Another secondary heading</h2>
<h3>Low level heading</h3>
```
- [ARIA Landmark Roles](/en-US/docs/Web/Accessibility/ARIA/Reference/Roles#3._landmark_roles) should be used to describe an app or document structure, such as `banner`, `complementary`, `contentinfo`, `main`, `navigation`, `search`.
- For touch events, ensure the following ([WCAG 2.1: Pointer Cancellation](https://www.w3.org/WAI/WCAG21/Understanding/pointer-cancellation.html)):
- The down-event should not be used to execute any part of the function;
- Failing the above, _completion_ of the function should be on the up-event, and a mechanism is available to abort the action before its completion or to undo the action after its completion;
- Failing the above, the up-event should be able to undo any action that was triggered on a down event;
- All the above may be violated if it is essential to trigger the action on the down event, usually to simulate real-world experiences or to provide real-time feedback. For example, game controls, piano keyboards, or virtual keyboards.
- Touch targets must be large enough for the user to interact with (see the [BBC Mobile Accessibility Guidelines](https://www.bbc.co.uk/accessibility/forproducts/guides/mobile/target-touch-size) for useful touch target size guidelines).
> [!NOTE]
> The [original version of this document](https://yzen.github.io/firefoxos/2014/04/30/mobile-accessibility-checklist.html) was written by [Yura Zenevich](https://yzen.github.io/).
|
---
title: "Accessibility: What personalization helps browse more safely"
short-title: Personalization to help browse safely
slug: Web/Accessibility/Guides/Browsing_safely
page-type: guide
sidebar: accessibilitysidebar
---
This article discusses making web content accessible for those with vestibular disorders, and those who support them, by taking advantage of personalization and accessibility settings built into the operating systems. Taking advantage of personalization settings can help prevent exposure to content leading to seizures and / or other physical reactions.
## Personalization and accessibility settings
From the article, "**[Understanding Success Criterion 2.3.1: Three Flashes or Below Threshold](https://www.w3.org/WAI/WCAG21/Understanding/three-flashes-or-below-threshold.html)**"
> Flashing can be caused by the display, the computer rendering the image or by the content being rendered. The author has no control of the first two. They can be addressed by the design and speed of the display and computer
### Hardware and operating systems on many computers offer control that is not afforded to developers
The user can do much to protect himself by learning his operating system, its personalization and accessibility settings. Those in the public sector who must accommodate those with special sensitivities, should consider setting aside at least one work station and becoming familiar with its personalization and accessibility settings. Understanding personalization and accessibility settings can actually be a money-saving endeavor. One work station can be set up to accommodate both a low-vision individual (needs high-contrast) and to accommodate an individual with photosensitive susceptibilities, by, adjusting personalization and accessibility settings.
### Use modern browsers. Learn personalization and accessibility settings
Modern browsers support the CSS media feature [`prefers-reduced-motion`](/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-reduced-motion). Browsers can detect whether a user has requested a reduced motion experience. The user would access this through an accessibility interface, as seen below.

CSS Transition events are supported. Examples include:
- `transitionrun`
- `transitionstart`
- `transitionend`
- `transitioncancel`
### Safari 10.1 and above (Desktop)
Do not enable Auto-Play (does not work for GIFs)
#### iOS Safari 10.3 and above (Mobile and Tablet)
Select the "Reduce motion option" in OS Accessibility settings for Apple (image source: developers.google.com from Thomas Steiner's article "Move Ya! Or maybe, don't, if the user prefers-reduced-motion!"). This will not work on animated GIFs; the source of the animation is self-contained within a gif and is not affected by these settings.
#### Use Reader Mode on browsers
- Enable Content Blockers; Gets rid of ads, reduces and/or removes distractions
- Enables text-to-speech
- In certain browsers, enable fonts by choice
- Enable Page Zoom
#### Turn off animated GIFs in the browser
Browsers offer much power to their users; it's just a matter of knowing where to go. Using Firefox as an example, it explains that by changing the value the **image.animation_mode** from "normal" to "none", all animated images will be blocked. To reverse it, you will have to change the value back to "normal"

#### Use browser extensions
- [Gif Blocker](https://chromewebstore.google.com/detail/gif-blocker/ahkidgegbmbnggcnmejhobepkaphkfhl?hl=en) For Chrome, GIF Blocker is an extension available at the web store.
- [Gif Scrubber](https://chromewebstore.google.com/detail/gif-scrubber/gbdacbnhlfdlllckelpdkgeklfjfgcmp?hl=en) Gif Scrubber is a chrome extension that allows you to control GIFs like a video player. There is a GitHub repository for it at **<https://github.com/0ui/gif-scrubber>**
- [Beeline Reader](https://www.beelinereader.com/) Beeline Reader has a browser extension that allows you to set up for grayscale and Dyslexi font, among other things

### Take advantage Operating System accessibility features
Most operating systems such as Windows 10, have accessibility options that are surprisingly powerful. Usually they are quite easy to find by typing (or saying) in the word, "Accessibility" in the search finder of the operating system.
#### Turn off animations in the operating system
In the Windows 10 operating system, the user has an ability to turn off animations. This will not work on animated GIFs; the source of the animation is self-contained within a gif and is not affected by these settings.

#### Grayscale
Those who have suffered traumatic brain injury (TBI) may be highly sensitive to color; it can require such a great "investment of cognitive energy" on their part, there's no energy for other daily tasks. Enabling grayscale presentation of the content reduces the cognitive workload. It may assist users with other disabilities, as well. An interesting discussion by users on the benefits of using grayscale may be found in the discussion thread, "[What is the "grayscale" setting for in accessibility options?](https://ask.metafilter.com/312049/What-is-the-grayscale-setting-for-in-accessibility-options)". Of particular interest is a user who has Photosensitive Epilepsy, and uses it when feeling "seizure-y".
Most Operating Systems have a way to let the user make an adjustment on the workstation. In the screenshot below, you can see an example of Windows 10 Accessibility Settings allowing for color filters to be selected. Grayscale is enabled when the color filters button is toggled "on"

## See also
- [Accessibility](/en-US/docs/Web/Accessibility)
- [Accessibility learning path](/en-US/docs/Learn_web_development/Core/Accessibility)
- [Web accessibility for seizures and physical reactions](/en-US/docs/Web/Accessibility/Guides/Seizure_disorders)
- [Color vision simulation](https://firefox-source-docs.mozilla.org/devtools-user/accessibility_inspector/simulation/index.html)
- Discussion: "[What is the "grayscale" setting for in accessibility options?](https://ask.metafilter.com/312049/What-is-the-grayscale-setting-for-in-accessibility-options)"
### Contributors
Many, many thanks to Eric Eggert from [Knowbility;](https://knowbility.org/) for his discussions and huge help on this topic.
|
---
title: Understanding the Web Content Accessibility Guidelines (WCAG)
short-title: Understanding WCAG
slug: Web/Accessibility/Guides/Understanding_WCAG
page-type: guide
sidebar: accessibilitysidebar
---
This set of articles provides quick explanations to help you understand the steps that need to be taken to conform to the recommendations outlined in the {{glossary("WCAG", "Web Content Accessibility Guidelines")}} (WCAG).
The WCAG guidelines are a set of recommendations for making web content more accessible developed by W3C's {{Glossary("WAI")}}, primarily for people with disabilities β but also for all user agents, including some highly limited devices or services, such as digital assistants.
WCAG 2.2 is the most recent version of the guidelines with WCAG 2.1 and 2.0 also widely used. WCAG 3.0 is the working draft.
Newer versions of WCAG are not meant to supersede previous versions, but WAI recommends using the most recent version to ensure the best possible accessibility for your website.
## The four principles
WCAG is broadly broken down into four principles β major things that web content **must be** to be considered accessible (see [Understanding the Four Principles of Accessibility](https://www.w3.org/WAI/WCAG22/Understanding/intro#understanding-the-four-principles-of-accessibility) for the WCAG definitions).
Each of the links below will take you to pages that further expand on these areas, giving you practical advice on how to write your web content so it conforms to the success criteria outlined in the WCAG 2 four guiding principles.
- [Perceivable](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Perceivable): Users must be able to perceive it in some way, using one or more of their senses.
- [Operable](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Operable): Users must be able to control UI elements (e.g., buttons must be clickable in some way β mouse, keyboard, voice command, etc.).
- [Understandable](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Understandable): The content must be understandable to its users.
- [Robust](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Robust): The content must be developed using well-adopted web standards that will work across different browsers, now and in the future.
We also included two additional WCAG resources focused on making sites [keyboard accessible](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Keyboard) and provided descriptive names or labels with [text labels and names](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Text_labels_and_names).
## Legal standing
This introductory documentation is intended to provide practical information to help you build better, more accessible websites. However, we are not lawyers, and none of this constitutes legal advice. If you are worried about the legal implications of web accessibility, we recommend that you check the specific legislation governing accessibility for the web and public resources in your country or locale and seek the advice of a qualified lawyer.
[What is accessibility?](/en-US/docs/Learn_web_development/Core/Accessibility/What_is_accessibility) and particularity the [Accessibility guidelines and the law](/en-US/docs/Learn_web_development/Core/Accessibility/What_is_accessibility#accessibility_guidelines_and_the_law) section provide more related information.
## See also
- [WCAG: Perceivable](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Perceivable) principle
- [WCAG: Operable](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Operable) principle
- [WCAG: Understandable](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Understandable) principle
- [WCAG: Robust](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Robust) principle
- [WCAG text labels and names](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Text_labels_and_names)
- [WCAG keyboard accessibility](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Keyboard)
- [WCAG Overview](https://www.w3.org/WAI/standards-guidelines/wcag/)
- [WCAG 2.2](https://w3c.github.io/wcag/guidelines/22/)
|
---
title: Keyboard accessible
slug: Web/Accessibility/Guides/Understanding_WCAG/Keyboard
page-type: guide
sidebar: accessibilitysidebar
---
To be fully accessible, a web page must be operable by someone using only a keyboard to access and control it. This includes users of screen readers, but can also include users who have trouble operating a pointing device such as a mouse or trackball, or whose mouse is not working at the moment, or who prefer to use a keyboard for input whenever possible.
## Focusable elements should have interactive semantics
If an element can be focused using the keyboard, then it should be interactive; that is, the user should be able to do something to it and produce a change of some kind (for example, activating a link or changing an option).
> [!NOTE]
> One important exception to this rule is if the element has `role="document"` applied to it, **inside** an interactive context (such as `role="application"`). In such a case, focusing the nested document is the only way of returning assistive technology to a non-interactive state (often called "browse mode").
Most interactive elements are focusable by default; you can make an element focusable by adding a `tabindex=0` attribute value to it. However, you should only add `tabindex` if you have also made the element interactive, for example, by defining appropriate event handlers keyboard events.
### See also
- [tabindex](/en-US/docs/Web/HTML/Reference/Global_attributes/tabindex) global HTML attribute
- Element: [keydown event](/en-US/docs/Web/API/Element/keydown_event)
- Element: [keyup event](/en-US/docs/Web/API/Element/keyup_event)
## Avoid using `tabindex` attribute greater than zero
The `tabindex` attribute indicates that an element is focusable using the keyboard. A value of zero indicates that the element is part of the default focus order, which is based on the ordering of elements in the HTML document. A positive value puts the element ahead of those in the default ordering; elements with positive values are focused in the order of their `tabindex` values (1, then 2, then 3, etc.).
This creates confusion for keyboard-only users when the focus order differs from the logical order of the page. A better strategy is to structure the HTML document so that focusable elements are in a logical order, without the need to re-order them with positive `tabindex` values.
### See also
- [tabindex](/en-US/docs/Web/HTML/Reference/Global_attributes/tabindex) global HTML attribute
- [Understanding focus order](https://www.w3.org/WAI/WCAG21/Understanding/focus-order.html)
- [Don't use tabindex greater than 0](https://adrianroselli.com/2014/11/dont-use-tabindex-greater-than-0.html)
## Clickable elements must be focusable and should have interactive semantics
If an element can be clicked with a pointing device, such as a mouse, then it should also be focusable using the keyboard, and the user should be able to do something by interacting with it.
An element is clickable if it has an `onclick` event handler defined. You can make it focusable by adding a `tabindex=0` attribute value to it. You can make it operable with the keyboard by defining an `onkeydown` event handler; in most cases, the action taken by event handler should be the same for both types of events.
### See also
- [tabindex](/en-US/docs/Web/HTML/Reference/Global_attributes/tabindex) global HTML attribute
- Element: [keydown event](/en-US/docs/Web/API/Element/keydown_event)
- Element: [keyup event](/en-US/docs/Web/API/Element/keyup_event)
## Interactive elements must be able to be activated using a keyboard
If the user can interact with an element using touch or a pointing device, then the element should also support interacting using the keyboard. That is, if you have defined event handlers for touch or click events, you should also define them for keyboard events. The keyboard event handlers should enable effectively the same interaction as the touch or click handlers.
### See also
- Element: [keydown event](/en-US/docs/Web/API/Element/keydown_event)
- Element: [keyup event](/en-US/docs/Web/API/Element/keyup_event)
## Interactive elements must be focusable
If the user can interact with an element (for example, using touch or a pointing device), then it should be focusable using the keyboard. You can make it focusable by adding a `tabindex=0` attribute value to it. That will add the element to the list of elements that can be focused by pressing the <kbd>Tab</kbd> key, in the sequence of such elements as defined in the HTML document.
### See also
- [tabindex](/en-US/docs/Web/HTML/Reference/Global_attributes/tabindex) global HTML attribute
## Focusable element must have focus styling
Any element that can receive keyboard focus should have visible styling that indicates when the element is focused. You can do this with the {{cssxref(":focus")}} and {{cssxref(":focus-visible")}} CSS pseudo-classes.
Standard focusable elements such as links and input fields are given special styling by the browser by default, so you might not need to specify focus styling for such elements, unless you want the focus styling to be more distinctive.
If you create your own focusable components, be sure that you also define focus styling for them.
### See also
- [Using CSS to change the presentation of a UI component when it receives focus](https://www.w3.org/WAI/WCAG21/Techniques/css/C15.html)
|
---
title: Robust
slug: Web/Accessibility/Guides/Understanding_WCAG/Robust
page-type: guide
sidebar: accessibilitysidebar
---
This article provides practical advice on how to write your web content so that it conforms to the success criteria outlined in the **Robust** principle of the Web Content Accessibility Guidelines (WCAG) 2.0 and 2.1. Robust states that content must be robust enough that it can be interpreted reliably by a wide variety of user agents, including assistive technologies. This can generally be achieved by following web standards and [testing rigorously](/en-US/docs/Learn_web_development/Extensions/Testing).
> [!NOTE]
> To read the W3C definitions for Robust and its guidelines and success criteria, see [Principle 4: Robust β Content must be robust enough that it can be interpreted reliably by a wide variety of user agents, including assistive technologies.](https://w3c.github.io/wcag/guidelines/22/#robust)
## Guideline 4.1 β Compatible: Maximize compatibility with current and future user agents, including assistive technologies
This guideline focuses on making content as compatible as possible, not only with current user agents (e.g., browsers), but also with future ones too.
<table class="standard-table">
<thead>
<tr>
<th scope="col">Success criteria</th>
<th scope="col">How to conform to the criteria</th>
<th scope="col">Practical resource</th>
</tr>
</thead>
<tbody>
<tr>
<td>4.1.1 Parsing (A)</td>
<td>
<p>
Content should be well-formed so it can be parsed successfully by
browsers and other user agents such as screen readers.
</p>
<p>
To pass this criterion, make sure that your HTML is as valid as
possible. Use the
<a href="https://validator.w3.org/">W3C validator</a> to validate your
markup.
</p>
</td>
<td>
See
<a href="/en-US/docs/Learn_web_development/Core/Structuring_content/Debugging_HTML"
>Debugging HTML</a
>
for a practical guide.
</td>
</tr>
<tr>
<td>4.1.2 Name, Role, Value (A)</td>
<td>
<p>
The name and role of user interface components (e.g., form inputs,
buttons, links, etc.) should be programmatically determinable.
</p>
<p>
When using semantic elements correctly for their intended purpose,
this criterion should be passed automatically. When scripting custom
components, you will need to use WAI-ARIA roles and other features to
make sure your controls will be interpreted and are able to be used as
intended, e.g., not only by sighted mouse users, but also by
screen reader users, keyboard-only users, etc.
</p>
</td>
<td>
See
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML"
>HTML: A good basis for accessibility</a
>
and
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/WAI-ARIA_basics"
>WAI-ARIA basics</a
>.
</td>
</tr>
<tr>
<td>
4.1.3 Status Messages (AA)
</td>
<td>
<p>
Assistive technology users are made aware of new status messages added
to the page.
</p>
</td>
<td>
<a
href="https://www.w3.org/WAI/WCAG21/Understanding/status-messages.html"
>Understanding Status Messages</a
>
</td>
</tr>
</tbody>
</table>
> [!NOTE]
> Also see the WCAG description for [Guideline 4.1: Compatible: Maximize compatibility with current and future user agents, including assistive technologies.](https://w3c.github.io/wcag/guidelines/22/#compatible)
## See also
- [WCAG](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG)
1. [Perceivable](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Perceivable)
2. [Operable](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Operable)
3. [Understandable](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Understandable)
4. Robust
|
---
title: Perceivable
slug: Web/Accessibility/Guides/Understanding_WCAG/Perceivable
page-type: guide
sidebar: accessibilitysidebar
---
This article provides practical advice on how to write your web content so that it conforms to the success criteria outlined in the **Perceivable** principle of the Web Content Accessibility Guidelines (WCAG) 2.0 and 2.1. Perceivable states that users must be able to perceive it in some way, using one or more of their senses.
> [!NOTE]
> To read the W3C definitions for Perceivable and its guidelines and success criteria, see [Principle 1: Perceivable - Information and user interface components must be presentable to users in ways they can perceive.](https://w3c.github.io/wcag/guidelines/22/#perceivable)
## Guideline 1.1 β Providing text alternatives for non-text content
The key here is that text can be converted to other forms that people with disabilities can use. For example, it can be spoken by a screen reader, converted to large print, or represented on a braille display. Non-text content refers to multimedia such as images, audio, and video.
<table class="standard-table">
<thead>
<tr>
<th scope="col">Success criteria</th>
<th scope="col">How to conform to the criteria</th>
<th scope="col">Practical resource</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="5">1.1.1 Provide text equivalents (A)</td>
<td>
All images that convey meaningful content should be given suitable
alternative text.
</td>
<td>
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#text_alternatives"
>Text alternatives.</a
>
</td>
</tr>
<tr>
<td>
Complex images or charts should have an accessible alternative provided,
either on the same page or via a link. Use a regular link instead of
a <code>longdesc</code> attribute.
</td>
<td>
<p>
A text description may work, or an accessible data table (see
<a href="/en-US/docs/Learn_web_development/Core/Structuring_content/Table_accessibility"
>HTML table accessibility</a
>). See W3C's
<a href="https://www.w3.org/TR/html-longdesc/">Image Description Extension (longdesc)</a>
for the argument against <code>longdesc</code>.
</p>
</td>
</tr>
<tr>
<td>
Multimedia content (i.e., audio or video) should at least have a
descriptive identification available, such as a caption or similar.
</td>
<td>
<p>
See <a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#text_alternatives"
>Text alternatives</a
>
for static caption options, and
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/Multimedia#audio_transcripts"
>Audio transcripts</a
>,
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/Multimedia#video_text_tracks"
>Video text tracks</a
>
for other alternatives.
</p>
</td>
</tr>
<tr>
<td>
UI controls such as form elements and buttons should have text labels
that describe their purpose.
</td>
<td>
Buttons are simpleβyou should make sure the button text describes the
function of the button (e.g., <code
><button>Upload image</button></code
>). For more information on other UI controls, see
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#use_semantic_ui_controls_where_possible"
>Use semantic UI controls where possible</a
>.
</td>
</tr>
<tr>
<td>
Implement decorative (non-content) images, video, etc., in a way that is
invisible to assistive technology, so it doesn't confuse users.
</td>
<td>
<p>
Decorative images should be implemented using CSS background images
(see
<a
href="/en-US/docs/Learn_web_development/Core/Styling_basics/Backgrounds_and_borders"
>Backgrounds and borders</a
>). If you have to include an image via an
{{htmlelement("img")}} element, give it a blank alt
(<code>alt=""</code>). Otherwise, screen readers may try to read out
the filepath, etc.
</p>
<p>
If you are including background video or audio that autoplays, make it
as unobtrusive as possible. Don't make it look/sound like content, and
provide a control to turn it off. Ideally, don't include it at all.
</p>
</td>
</tr>
</tbody>
</table>
> [!NOTE]
> Also see the [WCAG description for Guideline 1.1: Text alternatives](https://w3c.github.io/wcag/guidelines/22/#text-alternatives).
## Guideline 1.2 β Providing text alternatives for time-based media
Time-based media refers to multimedia with a duration, such as audio and video. Note that if the audio/video serves as an alternative to existing text content, you don't need to provide another text alternative.
<table>
<thead>
<tr>
<th scope="col">Success criteria</th>
<th scope="col">How to conform to the criteria</th>
<th scope="col">Practical resource</th>
</tr>
</thead>
<tbody>
<tr>
<td>1.2.1 Provide alternatives for pre-recorded audio-only and video-only content (A)</td>
<td>A transcript should be provided for prerecorded audio-only media, and a transcript or audio description should be provided for prerecorded video-only media (i.e., silent video).</td>
<td>See <a href="/en-US/docs/Learn_web_development/Core/Accessibility/Multimedia#audio_transcripts">Audio transcripts</a> for transcript information. No audio description tutorial is available yet.</td>
</tr>
<tr>
<td>1.2.2 Provide captions for web-based video (A)</td>
<td>You should provide captions for video presented on the web (e.g., HTML video). This is for the benefit of people who can't hear the audio part of the video.</td>
<td>See <a href="/en-US/docs/Learn_web_development/Core/Accessibility/Multimedia#video_text_tracks">Video text tracks</a> for HTML video captions. See also <a href="https://support.google.com/youtube/answer/2734796?hl=en">Add your own subtitles & closed captions</a> (YouTube).</td>
</tr>
<tr>
<td>1.2.3 Provide text transcript or audio description for web-based video (A)</td>
<td>You should provide text transcripts or audio descriptions for video presented on the web (e.g., HTML video. This is for the benefit of people who can't see the visual part of the video, and don't get the full content from the audio alone.</td>
<td>See <a href="/en-US/docs/Learn_web_development/Core/Accessibility/Multimedia#audio_transcripts">Audio transcripts</a> for transcript information. No audio description tutorial is available yet.</td>
</tr>
<tr>
<td>1.2.4 Provide captions for live audio (AA)</td>
<td>You should provide synchronized captions for all live multimedia that contains audio (e.g., video conferences, live audio broadcasts).</td>
<td></td>
</tr>
<tr>
<td>1.2.5 Provide audio descriptions for prerecorded video (AA)</td>
<td>Audio descriptions should be provided for prerecorded video, but only where the existing audio does not convey the full meaning expressed by the video.</td>
<td></td>
</tr>
<tr>
<td>1.2.6 Provide sign language equivalent to prerecorded audio (AAA)</td>
<td>An equivalent sign language video should be provided for any prerecorded content containing audio.</td>
<td></td>
</tr>
<tr>
<td>1.2.7 Provide extended video with audio descriptions (AAA)</td>
<td>Where audio descriptions cannot be provided (see 1.2.5) due to video timing issues (e.g., there are no suitable pauses in the content in which to insert the audio descriptions), an alternative version of the video should be provided that includes inserted pauses (and audio descriptions).</td>
<td></td>
</tr>
<tr>
<td>1.2.8 Provide an alternative for prerecorded media (AAA)</td>
<td>For all content that features video, a descriptive text transcript should be provided, for example a script of the movie you are watching. This is for the benefit of hearing-impaired viewers who cannot hear the content.</td>
<td>See <a href="/en-US/docs/Learn_web_development/Core/Accessibility/Multimedia#audio_transcripts">Audio transcripts</a> for transcript information.</td>
</tr>
<tr>
<td>1.2.9 Provide a transcript for live audio (AAA)</td>
<td>For any live audio content being broadcast, a descriptive text should be provided, for example a script of the play or musical you are listening to. This is for the benefit of hearing-impaired viewers who cannot hear the content.</td>
<td>See <a href="/en-US/docs/Learn_web_development/Core/Accessibility/Multimedia#audio_transcripts">Audio transcripts</a> for transcript information.</td>
</tr>
</tbody>
</table>
> [!NOTE]
> Also see the [WCAG description for Guideline 1.2: Time-based Media: Provide alternatives for time-based media](https://w3c.github.io/wcag/guidelines/22/#time-based-media).
## Guideline 1.3 β Create content that can be presented in different ways
This guideline refers to the ability of content to be consumed by users in multiple ways, accommodating their differing needs.
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Success criteria</th>
<th scope="col">How to conform to the criteria</th>
<th scope="col">Practical resource</th>
</tr>
<tr>
<td>1.3.1 Info and relationships (A)</td>
<td>
<p>
Any content structureβor visual relationship made between contentβcan
also be determined programmatically, or be inferred from text
description. The main situations in which this is relevant are:
</p>
<ul>
<li>
Text labels and the form elements they describe. These are
associated unambiguously using the {{htmlelement("label")}}
element, which can be picked up by screen readers, etc.
</li>
<li>
Image alt text. Content images should have text available that
clearly describes the image's contents, which can be
programmatically associated with it (e.g., alt text),
or otherwise is easy to associate (e.g., describes it and is sat
right next to it). This should mean that the full meaning can still
be inferred even if you can't see the image.
</li>
<li>
Lists. If the order of list items is important, use an ordered list
({{htmlelement("ol")}}).
</li>
</ul>
</td>
<td>
The whole of
<p>
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML"
>HTML: A good basis for accessibility</a
>
is packed with information about this, but you should particularly
refer to
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#good_semantics"
>Good semantics</a
>,
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#use_semantic_ui_controls_where_possible"
>Use semantic UI controls where possible</a
>, and
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#text_alternatives"
>Text alternatives</a
>.
</p>
</td>
</tr>
<tr>
<td>1.3.2 Meaningful content sequence (A)</td>
<td>
A sensible, logical reading order should be easy to determine for any
content, even if it is visually presented in an unusual way. The order
should be made obvious by use of correct semantic elements (e.g.,
headings, paragraphs), with CSS being used to create any unusual layout
styles, irrespective of the markup.
</td>
<td>
Again, refer to
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML"
>HTML: A good basis for accessibility</a
>.
</td>
</tr>
<tr>
<td>1.3.3 Sensory characteristics (A)</td>
<td>
<p>
Instructions for operating controls or understanding content do not
rely on a single sense. This may prove inaccessible to people with a
disability related to that sense, or a device that does not support
that sense. So, for example:
</p>
<ul>
<li>
"Click the round button to continue"<br />The button should be
clearly labelled so that it is obvious that it is the button you
need to press. If there are multiple buttons, make sure they are all
clearly labelled to distinguish their function.
</li>
<li>
"Listen to the audio instructions for guidance"<br />This is
obviously problematicβaudio will be inaccessible to those with
hearing impairments, whereas text can be read, but also spoken by a
screen reader if required.
</li>
<li>
"Swipe from the right-hand side of the screen to reveal the menu"<br />Some
users might not be able to swipe the screen, either due to
disability or because their device does not support touch. An
alternative should be provided, such as a keyboard shortcut or
button that can be activated by keyboard or other means.
</li>
</ul>
<div class="note notecard">
<p>
<strong>Note:</strong> Conveying instructions solely by color is
related, but covered in a different guideline β 1.4.1.
</p>
</div>
</td>
<td></td>
</tr>
<tr>
<td>
1.3.4 Orientation (AA)
</td>
<td>
Content does not restrict its view and operation to a single display
orientation, such as portrait or landscape, unless a specific display
orientation is essential.
</td>
<td>
<p>
<a href="https://www.w3.org/WAI/WCAG21/Understanding/orientation.html"
>Understanding Orientation</a
>
</p>
</td>
</tr>
<tr>
<td>
1.3.5 Identify Input Purpose (AA)
</td>
<td>
<p>
Follow the list of
<a href="https://w3c.github.io/wcag/guidelines/22/#input-purposes"
>53 input fields</a
>
to programmatically identify the purpose of a field.
</p>
</td>
<td>
<a
href="https://www.w3.org/WAI/WCAG21/Understanding/identify-input-purpose.html"
>Understanding Identify Input Purpose</a
>
</td>
</tr>
<tr>
<td>
1.3.6 Identify Purpose (AAA)
</td>
<td>
In content implemented using markup languages, the purpose of user
interface components, icons, and regions can be programmatically
determined.
</td>
<td>
<a
href="https://www.w3.org/WAI/WCAG21/Understanding/identify-purpose.html"
>Understanding Identify Purpose</a
>
</td>
</tr>
</tbody>
</table>
> [!NOTE]
> Also see the WCAG description for [Guideline 1.3: Adaptable: Create content that can be presented in different ways without losing information or structure.](https://w3c.github.io/wcag/guidelines/22/#adaptable)
## Guideline 1.4: Make it easier for users to see and hear content including separating foreground from background
This guideline relates to making sure core content is easy to discern from backgrounds and other decoration. The classic example is color (both [color contrast](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Perceivable/Color_contrast) and [use of color](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Perceivable/Use_of_color) to convey instructions), but it applies in other situations too.
<table class="standard-table">
<thead>
<tr>
<th scope="col">Success criteria</th>
<th scope="col">How to conform to the criteria</th>
<th scope="col">Practical resource</th>
</tr>
<tr>
<td>1.4.1 Use of color (A)</td>
<td>
<p>
Color should not be solely relied upon to convey information. For
example, in forms, you should never mark required fields purely with a
color (like red). Instead (or as well as), something like an asterisk
with a label of "required" would be more appropriate.
</p>
</td>
<td>
See
<a href="/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Perceivable/Use_of_color"
>Use of color</a
>,
<a
href="/en-US/docs/Learn_web_development/Core/Accessibility/CSS_and_JavaScript#color_and_color_contrast"
>Color and color contrast</a
>,
and
<a
href="/en-US/docs/Learn_web_development/Extensions/Forms/How_to_structure_a_web_form#multiple_labels"
>Multiple labels</a
>.
</td>
</tr>
<tr>
<td>1.4.2 Audio controls (A)</td>
<td>
For any audio that plays for longer than three seconds, provide
accessible controls to play and pause the audio/video, and mute/adjust
volume.
</td>
<td>
Use native <code><button></code>s to provide accessible keyboard
controls, as shown in
<a
href="/en-US/docs/Web/Media/Guides/Audio_and_video_delivery/Video_player_styling_basics"
>Video player styling basics</a
>.
</td>
</tr>
<tr>
<td>1.4.3 Minimum contrast (AA)</td>
<td>
<p>
The color contrast between background and foreground content should be
at a minimum level to ensure legibility:
</p>
<ul>
<li>
Text and its background should have a contrast ratio of at least
4.5:1.
</li>
<li>
Heading (or just larger) text should have a ratio of at least 3:1.
Larger text is defined as at least 18pt, or 14pt bold.
</li>
</ul>
</td>
<td>
See
<a href="/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Perceivable/Color_contrast"
>Color contrast</a
> and
<a
href="/en-US/docs/Learn_web_development/Core/Accessibility/CSS_and_JavaScript#color_and_color_contrast"
>Color and color contrast</a
>.
</td>
</tr>
<tr>
<td>1.4.4 Resize text (AA)</td>
<td>
The page should be readable and usable when the text size is doubled.
This means that designs should be responsive, so that when the text size
is increased, the content is still accessible.
</td>
<td></td>
</tr>
<tr>
<td>1.4.5 Images of text (AA)</td>
<td>
Images should NOT be used to present content where text would do the
job. For example, if an image is mostly textual, it could be represented
using text as well as images.
</td>
<td></td>
</tr>
<tr>
<td>1.4.6 Enhanced contrast (AAA)</td>
<td>
<p>This follows, and builds on, criterion 1.4.3.</p>
<ul>
<li>
Text and its background should have a contrast ratio of at least
7:1.
</li>
<li>
Heading (or just larger) text should have a ratio of at least 4.5:1.
Larger text is defined as at least 18pt, or 14pt bold.
</li>
</ul>
</td>
<td>
See
<a
href="/en-US/docs/Learn_web_development/Core/Accessibility/CSS_and_JavaScript#color_and_color_contrast"
>Color and color contrast</a
>.
</td>
</tr>
<tr>
<td>1.4.7 Low or no background audio (AAA)</td>
<td>
Prerecorded audio recordings that primarily feature speech should have
minimal background noise, so the content can be easily understood.
</td>
<td></td>
</tr>
<tr>
<td>1.4.8 Visual presentation (AAA)</td>
<td>
<p>For text content presentation, the following should be true:</p>
<ul>
<li>Foreground and background colors should be user-selectable.</li>
<li>
Text blocks should be no wider than 80 characters (or glyphs), for
maximum readability.
</li>
<li>
Text should not be fully justified (e.g., <code
>text-align: justify;</code
>).
</li>
<li>
Line height should be at least 1.5 times the text size within
paragraphs (e.g., <code>line-height: 1.5;</code>), and at least 2.25
times the text size between paragraphs (e.g., <code
>padding: 2.25rem;</code
>).
</li>
<li>
When the text size is doubled, the content should not need to be
scrolled.
</li>
</ul>
</td>
<td></td>
</tr>
<tr>
<td>1.4.9 Images of text (No Exception) (AAA)</td>
<td>
Text should not be presented as part of an image unless it is purely
decoration (i.e., it does not convey any content) or cannot be presented
in any other way.
</td>
<td></td>
</tr>
<tr>
<td>
1.4.10 Reflow (AA)
</td>
<td>
<ul>
<li>
No horizontal scrolling for left-to-right languages (like English)
or right-to-left languages (like Arabic)
</li>
<li>
No vertical scrolling for top-to-bottom languages (like Japanese)
</li>
<li>
Except for parts of the content which require two-dimensional layout
for usage or meaning (like a large data table)
</li>
</ul>
</td>
<td>
<a href="https://www.w3.org/WAI/WCAG21/Understanding/reflow.html"
>Understanding Reflow</a
>
</td>
</tr>
<tr>
<td>
1.4.11 Non-Text Contrast(AA)
</td>
<td>
Minimum color contrast ratio of 3:1 for user interface components and
graphical objects.
</td>
<td>
<a
href="https://www.w3.org/WAI/WCAG21/Understanding/non-text-contrast.html"
>Understanding Non-Text Contrast</a
>
</td>
</tr>
<tr>
<td>
1.4.12 Text Spacing (AA)
</td>
<td>
<p>
No loss of content or functionality occurs when the following styles
are applied:
</p>
<ul>
<li>
Line height (line spacing) to at least 1.5 times the font size
</li>
<li>
Spacing following paragraphs to at least 2 times the font size
</li>
<li>
Letter spacing (tracking) to at least 0.12 times the font size
</li>
<li>Word spacing to at least 0.16 times the font size</li>
</ul>
</td>
<td>
<a href="https://www.w3.org/WAI/WCAG21/Understanding/text-spacing.html"
>Understanding Text Spacing</a
>
</td>
</tr>
<tr>
<td>
1.4.13 Content on Hover or Focus (AA)
</td>
<td>
<p>
While additional content may appear and disappear in coordination with
hover and keyboard focus, this success criterion specifies three
conditions that must be met:
</p>
<ul>
<li>dismissible (can be closed/removed)</li>
<li>
hoverable (the additional content does not disappear when the
pointer is over it)
</li>
<li>
persistent (the additional content does not disappear without user
action)
</li>
</ul>
</td>
<td>
<a
href="https://www.w3.org/WAI/WCAG21/Understanding/content-on-hover-or-focus.html"
>Understanding Content on Hover or Focus</a
>
</td>
</tr>
</thead>
</table>
> [!NOTE]
> Also see the WCAG description for [Guideline 1.4: Distinguishable: Make it easier for users to see and hear content including separating foreground from background.](https://w3c.github.io/wcag/guidelines/22/#distinguishable)
## See also
- [WCAG](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG)
1. Perceivable
2. [Operable](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Operable)
3. [Understandable](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Understandable)
4. [Robust](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Robust)
|
---
title: Color contrast
slug: Web/Accessibility/Guides/Understanding_WCAG/Perceivable/Color_contrast
page-type: guide
sidebar: accessibilitysidebar
---
The [color contrast](https://w3c.github.io/wcag/guidelines/22/#dfn-contrast-ratio) between background and foreground content (that is, usually text) should be great enough to ensure legibility.
When designing readable interfaces for different vision capabilities, the WCAG guidelines recommend the following contrast ratios:
| Type of content | Minimum ratio (AA rating) | Enhanced ratio (AAA rating) |
| ------------------------------------------------------------------------------- | ------------------------- | --------------------------- |
| Body text | 4.5 : 1 | 7 : 1 |
| Large-scale text (120-150% larger than body text) | 3 : 1 | 4.5 : 1 |
| Active user interface components and graphical objects such as icons and graphs | 3 : 1 | Not defined |
These ratios do not apply to "incidental" text, such as inactive controls, logotypes, or purely decorative text.
See the [Solution](#solution) section below for further information.
Having good color contrast on your site benefits all your users, but it is particularly beneficial to users with certain types of color blindness and other similar conditions, who experience low contrast, and have trouble differentiating between similar colors. This is because they don't see bright and dark areas as readily as those without such conditions, and therefore have trouble seeing edges, borders, and other details.
It is good to have a cool design on your website, but the design is worthless if your users can't read your content.
## Examples
Let's have a look at some HTML and CSS code:
```html
<div class="good">Good contrast</div>
<div class="bad">Bad contrast</div>
```
```css
div {
/* General div styles here */
}
.good {
background-color: #5a80a9;
}
.bad {
background-color: #400064;
}
```
Both pieces of text have their default black color.
### Good Contrast
The "good" `<div>` has a neon blue background, which makes the text easy to read:
```html
<div class="good">Good contrast</div>
```
```css
div {
font-family: sans-serif;
text-align: center;
font-size: 2rem;
font-weight: bold;
width: 250px;
padding: 30px;
border-radius: 20px;
box-shadow: 4px 4px 4px black;
}
.good {
background-color: #5a80a9;
}
```
{{EmbedLiveSample('Good_Contrast', '100%', '100')}}
### Bad Contrast
The "bad" `<div>` on the other hand has a very dark purple background, which makes the text much harder to read:
```html
<div class="bad">Bad contrast</div>
```
```css
div {
font-family: sans-serif;
text-align: center;
font-size: 2rem;
font-weight: bold;
width: 250px;
padding: 30px;
border-radius: 20px;
box-shadow: 4px 4px 4px black;
}
.bad {
background-color: #400064;
}
```
{{EmbedLiveSample('Bad_Contrast', '100%', '100')}}
## Solution
When choosing a color scheme for your website, choose foreground and background colors that have good contrast. Make the color contrast as good as it can be within your design constraints β ideally go for the AAA rating (see 1.4.6 below), but at least meet the AA rating (see 1.4.3 below).
If you are including non-text content such as video or animation, you should follow 1.4.11 (again, see below).
To check your contrast as you make your color choices, use a tool such as WebAIM's [Color Contrast Checker](https://webaim.org/resources/contrastchecker/).
You can also check color contrast on the fly using Firefox's Developer Tools β see the [Accessibility inspector](https://firefox-source-docs.mozilla.org/devtools-user/accessibility_inspector/index.html) guide, and in particular the section [Check for accessibility issues](https://firefox-source-docs.mozilla.org/devtools-user/accessibility_inspector/index.html#check-for-accessibility-issues). Try using it on the live examples in the description section.
## Related WCAG success criteria
- [1.4.3 Minimum contrast (AA)](https://w3c.github.io/wcag/guidelines/22/#contrast-minimum)
- : The color contrast between background and foreground content should be at a minimum level to ensure legibility:
- Text and its background should have a contrast ratio of at least 4.5:1.
- Heading (or just larger) text should have a ratio of at least 3:1. Larger text is defined as at least 18pt, or 14pt bold.
- [1.4.6 Enhanced contrast (AAA)](https://w3c.github.io/wcag/guidelines/22/#contrast-enhanced)
- : This follows, and builds on, criterion 1.4.3.
- Text and its background should have a contrast ratio of at least 7:1.
- Heading (or just larger) text should have a ratio of at least 4.5:1.
- [1.4.11 Non-Text Contrast (AA)](https://w3c.github.io/wcag/guidelines/22/#non-text-contrast)
- : There should be a minimum color contrast ratio of 3 to 1 for user interface components and graphical objects.
## See also
- [Color and color contrast](/en-US/docs/Learn_web_development/Core/Accessibility/CSS_and_JavaScript#color_and_color_contrast)
- [Multiple labels](/en-US/docs/Learn_web_development/Extensions/Forms/How_to_structure_a_web_form#multiple_labels)
- [Understanding Non-Text Contrast](https://www.w3.org/WAI/WCAG21/Understanding/non-text-contrast.html)
|
---
title: Use of color
slug: Web/Accessibility/Guides/Understanding_WCAG/Perceivable/Use_of_color
page-type: guide
sidebar: accessibilitysidebar
---
While [color contrast](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Perceivable/Color_contrast) is often primarily an aesthetic choice, the _use of color_ on a website pertains to _using color to communicate information_. WCAG guideline 1.4.1 on the use of color requires that "color is not used as the only visual means of conveying information, indicating an action, prompting a response, or distinguishing a visual element."
## Solution
Use another factor in addition to color to convey information. For example, to indicate form validation errors, you can change the labels of the relevant fields by another font attribute as well as by color. Icons and symbols should differ by shape as well as by color.
To accommodate users with color vision disorders ("color blindness"), be careful when using a "stoplight" color metaphor, with green indicating "good" values and red indicating "bad" values. Users with red-green color blindness have trouble distinguishing red and green, and so may not be able to tell these values apart. Using an additional factor to signal "good" vs. "bad" is necessary. Avoid pure red and green in this situation; a reddish-orange and a bluish-green are distinguishable by color blind users, while still conveying the cultural "good" and "bad" meanings to users with normal color vision. [Color contrast](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Perceivable/Color_contrast) can be helpful in this context, as well, if one color is darker or lighter than the other.
## Related WCAG success criteria
- [1.4.1 Use of color (A)](https://w3c.github.io/wcag/guidelines/22/#use-of-color)
- : Color is not used as the only visual means of conveying information, indicating an action, prompting a response, or distinguishing a visual element.
## See also
- [Understanding Success Criterion 1.4.1: Use of Color](https://www.w3.org/WAI/WCAG21/Understanding/use-of-color.html)
- [Color contrast](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Perceivable/Color_contrast)
- [Color and color contrast](/en-US/docs/Learn_web_development/Core/Accessibility/CSS_and_JavaScript#color_and_color_contrast) in the Accessibility tutorials
|
---
title: Text labels and names
slug: Web/Accessibility/Guides/Understanding_WCAG/Text_labels_and_names
page-type: guide
sidebar: accessibilitysidebar
---
There are many situations in which a control, dialog, or other website feature should be given a descriptive name or label to allow users of assistive technologies to understand what its purpose is and how to operate it correctly. There are a number of different types of problems in this category, found in different contexts, and each has its own solution. The different problems and solutions are discussed in the sections below.
## Use alt attribute to label area elements that have the href attribute
In image maps, give each {{htmlelement("area")}} element an `alt` attribute containing a name that describes what resources the areas links to. Failure to do so makes an image map hard to use for users of assistive technology β they need alternative text to be able to understand the purpose of an image.
### Examples
The following example show an image map (taken from [H24: Providing text alternatives for the area elements of image maps](https://www.w3.org/TR/WCAG20-TECHS/H24.html)):
```html
<img
src="welcome.gif"
usemap="#map1"
alt="Areas in the library. Select an area for
more information on that area." />
<map id="map1" name="map1">
<area shape="rect" coords="0,0,30,30" href="reference.html" alt="Reference" />
<area
shape="rect"
coords="34,34,100,100"
href="media.html"
alt="Audio visual lab" />
</map>
```
See the [`<area>` element reference page](/en-US/docs/Web/HTML/Reference/Elements/area) for a live interactive example.
### See also
- {{htmlelement("area")}}
- [H24: Providing text alternatives for the area elements of image maps](https://www.w3.org/TR/WCAG20-TECHS/H24.html)
## Dialogs should be labeled
For any container whose contents act as a dialog box (for example, a modal dialog asking the user to make a choice or respond to an action being taken), give it a descriptive label or name, so that assistive technology users can easily discover what its purpose is.
A dialog box is generally denoted by an ARIA [`role="dialog"`](/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/dialog_role) or [`role="alertdialog"`](/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/alertdialog_role); you can use the [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-label) or [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-labelledby) attributes to provide a label.
### Examples
The following example shows a dialog box, defined as such using `role="dialog"` and labelled using `aria-labelledby`.
```html
<div
role="dialog"
aria-labelledby="dialog1Title"
aria-describedby="dialog1Desc">
<h2 id="dialog1Title">Your personal details were successfully updated</h2>
<p id="dialog1Desc">
You can change your details at any time in the user account section.
</p>
<button>Close</button>
</div>
```
If the dialog box doesn't have a heading, you can instead use `aria-label` to contain the label text:
```html
<div role="dialog" aria-label="Personal details updated confirmation">
<p>
Your personal details were successfully updated. You can change your details
at any time in the user account section.
</p>
<button>Close</button>
</div>
```
### See also
- [`role="dialog"`](/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/dialog_role)
- [`role="alertdialog"`](/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/alertdialog_role)
- [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-label)
- [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-labelledby)
- [Dialog authoring practices](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/)
## Documents must have a title
It is important in each HTML document to include a {{htmlelement("title")}} that describes the page's purpose. A common navigation technique for users of assistive technology is to infer what content a page contains by reading its title. If the title is not available, they have to navigate the page to determine its content, which can be a time consuming and potentially confusing process.
### Examples
The title for the reference article about the {{htmlelement("title")}} element is as follows:
```html
<title>
<title>: The Document Title element - HTML: Hypertext Markup Language |
MDN
</title>
```
Another example might look like so:
```html
<title>Fill in your details to register β myGov services</title>
```
To help the user, you can update the page title value to reflect significant page state changes (such as form validation problems):
```html
<title>2 errors β Fill in your details to register β myGov services</title>
```
### See also
- {{htmlelement("title")}}
## Embedded content must be labeled
Make sure that elements that embed content have a [title](/en-US/docs/Web/HTML/Reference/Global_attributes/title) attribute that describes the embedded content. This includes the {{htmlelement("embed")}} and {{htmlelement("object")}} elements. These elements are often used for graphical content, much like the {{HTMLelement("img")}} element. A descriptive title helps users of assistive technology understand what the element is showing.
## Figures with optional captions should be labeled
For best accessibility, include a {{HTMLElement("figcaption")}} within a {{HTMLElement("figure")}} element, even though doing so is technically optional. The caption is in addition to any alternative text on images within the figure. The caption describes the purpose of the figure in the document, which may be different from a description of a visual item, as provided by the alternative text.
### Example
The following example shows code for a figure with a caption. The `alt` attribute of the {{htmlelement("img")}} describes the appearance of the image; the {{htmlelement("figcaption")}} describes it from a functional perspective (in this case, the Latin name of the flower in the image).
```html
<figure>
<img
src="milkweed.jpg"
alt="Black and white close-up photo of milkweed flowers" />
<figcaption>Asclepias verticillata</figcaption>
</figure>
```
## Fieldset elements must be labeled
Fieldset elements must have a text description, similar to other form elements. Use the {{htmlelement("legend")}} element to describe the purpose of a fieldset.
## Use a legend to label a fieldset
When grouping a set of form elements together with a {{htmlelement("fieldset")}} element, you should include a nested {{htmlelement("legend")}} element inside it, containing a clear description of the group.
Users of assistive technology find this description helpful when trying to work out the overall purpose of the group. Without the legend, they would have to navigate around the individual form controls in the group to infer an idea of the overall purpose, which could result in confusion.
### Examples
```html
<form>
<fieldset>
<legend>Choose your favorite monster</legend>
<input type="radio" id="kraken" name="monster" value="K" />
<label for="kraken">Kraken</label><br />
<input type="radio" id="sasquatch" name="monster" value="S" />
<label for="sasquatch">Sasquatch</label><br />
<input type="radio" id="mothman" name="monster" value="M" />
<label for="mothman">Mothman</label>
</fieldset>
</form>
```
You can see a live, interactive version of this example on the [`<fieldset>` reference page](/en-US/docs/Web/HTML/Reference/Elements/fieldset).
### See also
- {{htmlelement("fieldset")}}
- {{htmlelement("legend")}}
## Form elements must be labeled
All elements within a form must have a {{htmlelement("label")}} that identifies its purpose. This applies to all types of {{htmlelement("input")}} items, as well as {{htmlelement("button")}}, {{htmlelement("output")}}, {{htmlelement("select")}}, {{htmlelement("textarea")}}, {{htmlelement("progress")}} and {{htmlelement("meter")}} elements, as well as any element with the [`switch` ARIA role](/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/switch_role).
The form element can be placed inside the {{htmlelement("label")}}, in which case the association between the form element and the label is obvious from the structure. Or, you can create an association between a {{htmlelement("label")}} and a form element by specifying the form element's `id` value as the value of the label's `for` attribute.
### Example
```html
<label
>I agree to the terms and conditions.
<input type="checkbox" id="terms" name="terms" />
</label>
<input type="checkbox" id="email-opt-in" name="opt-in" />
<label for="email-opt-in">Yes, please send me news about this product.</label>
```
## Form elements should have a visible text label
In addition to having a {{htmlelement("label")}} for every form element, those labels should be visible, not hidden. Visible labels help _all_ users understand the purpose of a form element. Do not rely on placeholder text, because it disappears as soon as the user starts typing.
## Frame elements must be labeled
Frame elements, both {{htmlelement("iframe")}} and the older, obsolete {{htmlelement("frame")}}, must have a title to describe the contents of the frame. Use the `title` attribute to label a frame element. Without a title, users of assistive technologies have to navigate into the frame in order to understand what it contains, which can be difficult and confusing.
The {{HTMLElement('frame')}} element is no longer part of the HTML specification. Support for it may be dropped by browsers in the future. In addition, it is difficult for screen readers to navigate pages with {{HTMLElement('frame')}} elements. For best accessibility and future maintenance, redesign any pages that use frames to use CSS to achieve a similar layout.
As a best practice, also provide a {{htmlelement("title")}} for the document that is enclosed in the frame, with content identical to the frame's `title` attribute. (This assumes that the enclosed document is under your control; if not, try to match the frame's `title` attribute to the document's title.) Some screen readers replace the contents of the `title` attribute with the contents of the enclosed document's {{htmlelement("title")}}. It's safest and most accessible to provide the same title in both places.
### Example
```html
<iframe
title="MDN Web docs"
width="300"
height="200"
src="https://developer.mozilla.org">
</iframe>
```
## Headings must be labeled
Make sure that your headings have non-empty text content, and are not hidden, such as with CSS `display:none` or `aria-hidden=true`. Users of screen readers rely on headings to understand the structure and content of a document.
Also, be sure you are using [heading elements](/en-US/docs/Web/HTML/Reference/Elements/Heading_Elements) only for actual section headings, and not as a shortcut way to make text stand out. Screen reader users typically "skim" a page's headings, much like sighted users; non-heading text that is marked-up with heading elements can cause confusion.
## Headings should have visible text content
Make sure that your headings have non-empty text content, and are not hidden, such as with CSS `display:none` or `aria-hidden=true`. Users of screen readers rely on headings to understand the structure and content of a document. Do not use heading elements to mark up images or other graphical content.
## Use title attribute to describe `<iframe>` content
Make sure that {{htmlelement("iframe")}} elements have a `title` attribute to describe the contents of the frame. Without a title, users of assistive technologies have to navigate into the frame in order to understand what it contains, which can be difficult and confusing.
As a best practice, also provide a {{htmlelement("title")}} for the document that is enclosed in the frame, with content identical to the frame's `title` attribute. (This assumes that the enclosed document is under your control; if not, try to match the frame's `title` attribute to the document's title.) Some screen readers replace the contents of the `title` attribute with the contents of the enclosed document's {{htmlelement("title")}}. It's safest and most accessible to provide the same title in both places.
## Content with images must be labeled
Provide descriptive text for all contentful (that is, non-decorative) images and image-like elements. This includes SVG images, {{htmlelement("img")}}, {{htmlelement("canvas")}}, {{htmlelement("map")}}, and {{htmlelement("area")}} elements, as well as {{htmlelement("input")}} elements where `type=image` and {{htmlelement("object")}} elements where the `type` starts with `image/`. The typical way to do this is with the `alt` attribute, but for elements that don't allow the `alt` attribute, such as {{htmlelement("canvas")}}, use [`role="img"`](/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/img_role) and [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-label) instead. Be sure that the description conveys what is shown in the image.
For `alt` attributes on images which _are_ purely decorative, an empty value can be used to signal to accessibility tools that the element should be ignored.
### Example
```html
<img
src="milkweed.jgp"
alt="Black and white close-up photo of milkweed flowers" />
```
## Interactive elements must be labeled
If an element is intended for users to interact with it, it should have a label. Interactive elements include links ({{htmlelement("a")}}), form elements, buttons, and any element that has a handler for mouse or keyboard events. The way to label an element depends on its type: for form elements, use a {{htmlelement("label")}}; for links, buttons and clickable elements, the text content of the element typically provides the label. If no other option exists for labeling an element, use the [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-label) attribute.
## Use label attribute on optgroup elements
In an {{htmlelement("optgroup")}} element, use the `label` attribute to describe the group so that assistive technologies can access it for their users.
### Example
In this example, the `label` attribute on the {{HTMLElement('optgroup')}} elements gives a category name for the group of options.
```html
<label for="dino-select">Choose a dinosaur:</label>
<select id="dino-select">
<optgroup label="Theropods">
<option>Tyrannosaurus</option>
<option>Velociraptor</option>
<option>Deinonychus</option>
</optgroup>
<optgroup label="Sauropods">
<option>Diplodocus</option>
<option>Saltasaurus</option>
<option>Apatosaurus</option>
</optgroup>
</select>
```
## Toolbars must be labeled when there is more than one toolbar
If you define more than one toolbar in a web application using the ARIA `toolbar` role, you must use the [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-label) attribute to label each one so that it can be described by assistive technology. It is a good practice to label a toolbar, even if there is only one per page.
### See also
- [W3C ARIA toolbar example](https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/examples/toolbar/)
## Related WCAG success criteria
- [1.1.1 Non-text Content (A)](https://w3c.github.io/wcag/guidelines/22/#non-text-content)
- : All non-text content that is presented to the user has a text alternative that serves the equivalent purpose, except for the situations listed in the above link.
- [2.4.4 Link Purpose (In Context) (A)](https://w3c.github.io/wcag/guidelines/22/#link-purpose-in-context)
- : The purpose of each link can be determined from the link text alone or from the link text together with its programmatically determined link context, except where the purpose of the link would be ambiguous to users in general.
- [2.4.9 Link Purpose (Link Only) (AAA)](https://w3c.github.io/wcag/guidelines/22/#link-purpose-link-only)
- : A mechanism is available to allow the purpose of each link to be identified from link text alone, except where the purpose of the link would be ambiguous to users in general.
|
---
title: Operable
slug: Web/Accessibility/Guides/Understanding_WCAG/Operable
page-type: guide
sidebar: accessibilitysidebar
---
This article provides practical advice on how to write your web content so that it conforms to the success criteria outlined in the **Operable** principle of the Web Content Accessibility Guidelines (WCAG) 2.0 and 2.1. Operable states that user interface components and navigation must be operable.
> [!NOTE]
> To read the W3C definitions for Operable and its guidelines and success criteria, see [Principle 2: Operable β User interface components and navigation must be operable.](https://w3c.github.io/wcag/guidelines/22/#operable)
## Guideline 2.1 β Keyboard Accessible: Make all functionality available from a keyboard
This guideline covers the necessity of making core website functionality available via a keyboard in addition to other means (e.g., mouse), so that users that rely on keyboard controls can access them.
<table class="standard-table">
<thead>
<tr>
<th scope="col">Success criteria</th>
<th scope="col">How to conform to the criteria</th>
<th scope="col">Practical resource</th>
</tr>
</thead>
<tbody>
<tr>
<td>2.1.1 Keyboard (A)</td>
<td>
All functionality should be accessible using keyboard controls, unless
it cannot be done using the keyboard (e.g., freehand drawing). Built-in
controls should be used where possible (e.g., tabbing through form
controls), and you should only build in custom functionality where
needed.
</td>
<td>
See
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#use_semantic_ui_controls_where_possible"
>Use semantic UI controls where possible</a
>
and
<a
href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#building_keyboard_accessibility_back_in"
>Building keyboard accessibility back in</a
>
</td>
</tr>
<tr>
<td>2.1.2 No keyboard trap (A)</td>
<td>
<p>
When entering a section of functionality using the keyboard, you
should be able to get out of that section again using <em>only</em> the
keyboard. For example, if you press <kbd>Enter</kbd>/<kbd>Return</kbd>
on a focused button to open an options window, you should be able to
close that window again and return to the main content using the
keyboard.
</p>
<p>
This is very important so that keyboard users do not get trapped on
specific sections of your apps.
</p>
</td>
<td></td>
</tr>
<tr>
<td>2.1.3 Keyboard β all functionality (AAA)</td>
<td>
This is a further step beyond criterion 2.1.1. To achieve AAA
conformance, all functionality should be accessible using keyboard
controls β with no exceptions.
</td>
<td>
See
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#use_semantic_ui_controls_where_possible"
>Use semantic UI controls where possible</a
>
and
<a
href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#building_keyboard_accessibility_back_in"
>Building keyboard accessibility back in</a
>
</td>
</tr>
<tr>
<td>
2.1.4 Character Key Shortcuts (A)
</td>
<td>
If a single character key shortcut exists, then at least one of the
following is true: single character key shortcuts can be turned off,
remapped or are only active when the relevant user interface component
is in focus.
</td>
<td>
<a
href="https://www.w3.org/WAI/WCAG21/Understanding/character-key-shortcuts.html"
>Understanding Character Key Shortcuts</a
>
</td>
</tr>
</tbody>
</table>
> [!NOTE]
> Also see the WCAG description for [Guideline 2.1 Keyboard Accessible: Make all functionality available from a keyboard](https://w3c.github.io/wcag/guidelines/22/#keyboard-accessible).
## Guideline 2.2 β Enough Time: Provide users enough time to read and use content
This guideline covers situations in which functionality may have a time limit. For example, purchases sometimes need to be completed within a time limit for security reasons.
<table class="standard-table">
<thead>
<tr>
<th scope="col">Success criteria</th>
<th scope="col">How to conform to the criteria</th>
<th scope="col">Practical resource</th>
</tr>
</thead>
<tbody>
<tr>
<td>2.2.1 Timing is adjustable (A)</td>
<td>
<p>
For functionality with time limits (e.g., completing a hotel or flight
booking often has a time limit), the user should be given controls to
allow them to adjust, extend or turn off the time limit.
</p>
<p>
Exceptions to this are activities with time limits longer than 20
hours, real time events (e.g., live multiplayer games), and any other
activity that requires a time limit and would be invalidated if it
were turned off.
</p>
</td>
<td></td>
</tr>
<tr>
<td>2.2.2 Pausing, stopping, hiding (A)</td>
<td>
<p>
For moving/blinking content that starts automatically, lasts longer
than 5 seconds, and is shown alongside other content, controls should
be provided to pause, stop, or hide it. This does not apply to
moving/blinking content that is essential to the experience. Examples
include scrolling text and videos.
</p>
<p>
For auto-updating information that starts automatically and is shown
alongside other content, controls should be provided to pause, stop,
or hide it, or to control the frequency of updates. This does not
apply to auto-updating content that is essential to the experience.
Examples include carousels or rotating announcements.
</p>
</td>
<td></td>
</tr>
<tr>
<td>2.2.3 No time limits (AAA)</td>
<td>
This builds on criteria 2.2.1, stating that content that wants to pass
AAA conformance should have no time limits.
</td>
<td></td>
</tr>
<tr>
<td>2.2.4 Suppress interruptions (AAA)</td>
<td>
Any interruptions such as alerts or interstitial adverts should have
functionality available to suppress or postpone them, unless it is an
emergency alert.
</td>
<td></td>
</tr>
<tr>
<td>2.2.5 Re-authenticating (AAA)</td>
<td>
If an authentication session expires during usage of a web app, the user
can re-authenticate and continue their usage without losing any data.
</td>
<td></td>
</tr>
<tr>
<td>
2.2.6 Timeouts (AAA)
</td>
<td>
<p>
If there is a timeout (caused by user inactivity) warn users at the
start of a process so they will not be surprised that a timeout exists
(or only allow the timeout to occur after 20 hours of inactivity).
</p>
</td>
<td>
<a href="https://www.w3.org/WAI/WCAG21/Understanding/timeouts.html"
>Understanding Timeouts</a
>
</td>
</tr>
</tbody>
</table>
> [!NOTE]
> Also see the WCAG description for [Guideline 2.2 Enough Time: Provide users enough time to read and use content](https://w3c.github.io/wcag/guidelines/22/#enough-time).
## Guideline 2.3 β Seizures and Physical Reactions: Do not design content in a way that is known to cause seizures or physical reactions
This refers to content that, if not changed, could cause seizures in users with conditions such as epilepsy OR could cause physical reactions (like dizziness) for users with conditions such as vestibular disorders.
<table>
<thead>
<tr>
<th scope="col">Success criteria</th>
<th scope="col">How to conform to the criteria</th>
<th scope="col">Practical resource</th>
</tr>
</thead>
<tbody>
<tr>
<td>2.3.1 Three flashes, or below threshold (A)</td>
<td>Content doesn't contain any aspect that Flashes more than three times per second, or flashing content is below acceptable <a href="https://w3c.github.io/wcag/guidelines/22/#dfn-general-flash-and-red-flash-thresholds">flash and red flash thresholds</a>.</td>
<td></td>
</tr>
<tr>
<td>2.3.2 Three flashes (AAA)</td>
<td>Content doesn't contain any aspect that Flashes more than three times per second.</td>
<td></td>
</tr>
<tr>
<td>2.3.3 Animations from Interactions (AAA)</em></td>
<td>Allow users to disable animations from interactions (unless the animation is essential).</td>
<td><a href="https://w3c.github.io/wcag/guidelines/22/#animation-from-interactions">Understanding Animations from Interactions</a></td>
</tr>
</tbody>
</table>
> [!NOTE]
> Also see the WCAG description for [Guideline 2.3 Seizures and Physical Reactions: Do not design content in a way that is known to cause seizures or physical reactions.](https://w3c.github.io/wcag/guidelines/22/#seizures-and-physical-reactions)
## Guideline 2.4 β Navigable: Provide ways to help users navigate, find content, and determine where they are
The conformance criteria under this guideline relate to ways in which users can be expected to orientate themselves, and find the content and functionality they are looking for on the current page or other pages of the site.
<table class="standard-table">
<thead>
<tr>
<th scope="col">Success criteria</th>
<th scope="col">How to conform to the criteria</th>
<th scope="col">Practical resource</th>
</tr>
</thead>
<tbody>
<tr>
<td>2.4.1 Bypass blocks (A)</td>
<td>
<p>
A mechanism should be provided that allows the user to skip straight
to the main content or functionality available on the page, past the
repeated features (such as the company logo or navigation). This is
often achieved using "skip links" β links put at the top of the page
source that link to the main content and are hidden by CSS.
</p>
<p>
If a proper structure of headings and semantic containers is provided
to navigate with (for example {{htmlelement("section")}},
{{htmlelement("aside")}}, etc.), then an added "skip link" is
not needed.
</p>
</td>
<td><em>Need to add a section on "skip links".</em></td>
</tr>
<tr>
<td>2.4.2 Include page title (A)</td>
<td>
Each web page should include an informative
{{htmlelement("title")}}, the content of which describes the
page's content/purpose.
</td>
<td>
See
<a
href="/en-US/docs/Learn_web_development/Core/Structuring_content/Webpage_metadata#adding_a_title"
>Adding a title</a
>.
</td>
</tr>
<tr>
<td>2.4.3 Logical focus order (A)</td>
<td>
The "tabbing order" of focusable page features (e.g., links, buttons,
form inputs) makes logical sense, meaning that the page is still usable
by non-sighted/keyboard users.
</td>
<td>
See
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#use_semantic_ui_controls_where_possible"
>Use semantic UI controls where possible</a
>
for general advice on tabbing to controls. If you need to place elements
in an unusual layout, it is better to make sure the source order is
sensible, then use CSS features like
<a href="/en-US/docs/Learn_web_development/Core/CSS_layout/Positioning">positioning</a>
to handle the layout.
</td>
</tr>
<tr>
<td>2.4.4 Link purpose (in context) (A)</td>
<td>
The purpose/destination of a link can be determined from the link text,
or from its surroundings (e.g., the surrounding text). Exceptions are
where the link purpose is ambiguous to <em>all</em> users (see
<a href="https://w3c.github.io/wcag/guidelines/22/#dfn-ambiguous-to-users-in-general"
>ambiguous to users in general</a
>
for a useful explanation of this).
</td>
<td>
See
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#use_meaningful_text_labels"
>Use meaningful text labels</a
>. Also note that you should minimize instances where multiple copies of
the same text are linked to different places. This can cause problems
for screen reader users, who will often bring up a list of the links out
of context β several links all labelled "click here", "click here",
"click here" would be confusing.
</td>
</tr>
<tr>
<td>2.4.5 Multiple navigation mechanisms (AA)</td>
<td>
<p>
You should provide at least two general navigation mechanisms to find
pages on your website, for example navigation menu, breadcrumb trail,
site search, site map, list of related links, etc.
</p>
<p>
The only exception to this is where a page is one step in a process,
so should only logically have links to the previous and next steps.
</p>
</td>
<td>
Most of these mechanisms can be created using fully supported HTML features, for
example see
<a
href="/en-US/docs/Learn_web_development/Extensions/Forms/HTML5_input_types#search_field"
>Search field</a
>,
<a
href="/en-US/docs/Learn_web_development/Core/Structuring_content/Creating_links#creating_a_navigation_menu"
>Creating a navigation menu</a
>,
<a
href="/en-US/docs/Learn_web_development/Core/Text_styling/Styling_links#styling_links_as_buttons"
>Styling links as buttons</a
>.
</td>
</tr>
<tr>
<td>2.4.6 Headings and labels (AA)</td>
<td>
Heading (e.g., {{htmlelement("Heading_Elements", "<h2>")}}) and
{{htmlelement("label")}} elements clearly describe the purpose
of the content and form elements they are supposed to be describing.
</td>
<td>
<p>
See
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#use_semantic_ui_controls_where_possible"
>Use semantic UI controls where possible</a
>,
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#use_meaningful_text_labels"
>Use meaningful text labels</a
>,
<a
href="/en-US/docs/Learn_web_development/Core/Structuring_content/Headings_and_paragraphs"
>The basics of headings and paragraphs</a
>,
<a
href="/en-US/docs/Learn_web_development/Extensions/Forms/How_to_structure_a_web_form#the_label_element"
>The <label> element</a
>.
</p>
<p>
Note that you should avoid duplicating headings or labels (e.g.
multiple instances of "Further information"), unless the structure
allows you to differentiate between them easily.
</p>
</td>
</tr>
<tr>
<td>2.4.7 Visible focus for focusable elements (AA)</td>
<td>
When tabbing through focusable elements such as links or form inputs,
there should be a visual indicator to show you which element currently
has focus. This is usually a dotted or blue outline by default
(depending on browser, platform, etc.), but this can be overridden by
CSS.
</td>
<td>
See
<a
href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#use_semantic_ui_controls_where_possible"
>Use semantic UI controls where possible</a
>.
</td>
</tr>
<tr>
<td>2.4.8 Location within site (AAA)</td>
<td>
When on a page inside a complex site or set of steps, the user should be
given an indicator of where they are in the site, for example a
breadcrumb trail, sitemap or text such as "Form page 2 of 10".
</td>
<td></td>
</tr>
<tr>
<td>2.4.9 Link purpose (link only) (AAA)</td>
<td>
This criterion builds on 2.4.4, stating that to conform to AAA, the
purpose/destination of a link should be determinable from the link text
alone, even if out of context.
</td>
<td>
See
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#use_meaningful_text_labels"
>Use meaningful text labels</a
>. Also note that you should minimize instances where multiple copies of
the same text are linked to different places. This can cause problems
for screen reader users, who will often bring up a list of the links out
of context β several links all labelled "click here", "click here",
"click here" would be confusing.
</td>
</tr>
<tr>
<td>2.4.10 Section headings (AAA)</td>
<td>
<p>
As well as creating a useful document structure, headings should also
accurately describe and break up content areas into logical sections.
</p>
<p>
Note that this criterion refers to headings and titles in general web
content (e.g., headings within text content). Headings and titles for
user interfaces are a special case covered in criterion 4.1.2.
</p>
</td>
<td>
<p>
See
<a
href="/en-US/docs/Learn_web_development/Core/Structuring_content/Headings_and_paragraphs"
>The basics of headings and paragraphs</a
>.
</p>
</td>
</tr>
<tr>
<td> 2.4.11 Focus not obscured (Minimum) (AA)</td>
<td>
<p> When a user interface component receives keyboard focus, the component is not entirely hidden due to containing author-created content.</p>
<p> <strong>Note:</strong> If the interface's content can be repositioned by the user, then only the initial position of the user-movable content is considered for testing to conform to this standard. Also, content opened by the user may obscure the component receiving focus. Furthermore, if the user can reveal the focused component without changing keyboard focus, the component with focus is not considered hidden for conformance and testing purposes.</p>
</td>
<td>
<p> Check out <a href="https://www.w3.org/WAI/WCAG22/Understanding/focus-not-obscured-minimum">Understanding focus not obscured (Minimum)</a> to learn more about this standard.</p>
</td>
</tr>
<tr>
<td> 2.4.12 Focus not obscured (Enhanced) (AAA) </td>
<td>
<p> Follows the rules as 2.4.11 except when a user interface component receives focus, no part of the component can be hidden by author-created content. If the interface is configurable, only the initial positions of user-movable content are considered for testing and meeting of this standard.</p>
</td>
<td>
<p> Check out <a href="https://www.w3.org/WAI/WCAG22/Understanding/focus-not-obscured-enhanced">Understanding focus not obscured (Enhanced) (Level AAA)</a> to learn more about this standard.</p> </td>
</td>
</tr>
<tr>
<td> 2.4.13 Focus appearance (AAA)</td>
<td>
<p>When the keyboard focus indicator is visible, the area of the focus indicator meets all the following:</p>
<ul>
<li>Must be at least as large as the area of a <code>2px</code> thick perimeter of the unfocused component or sub-component, which includes component's content, border, and background, excluding outer shadows or glow effects.</li>
<li>Needs to have a contrast ratio of at least 3:1 between the same pixels in the focused and unfocused states</li>
</ul>
<p> The exceptions to this are:</p>
<ul>
<li>The focus indicator is determined by the user and cannot be adjusted by the author.</li>
<li>The focus indicator and the indicator's background color are not modified by the author.</li>
</ul>
</td>
<td>
<p> Check out <a href="https://www.w3.org/WAI/WCAG22/Understanding/focus-appearance.html">Understanding focus appearance (Level AAA)</a> to learn more about this standard.</p>
</td>
</tr>
</tbody>
</table>
> [!NOTE]
> Also see the WCAG description for [Guideline 2.4 Navigable: Provide ways to help users navigate, find content, and determine where they are.](https://w3c.github.io/wcag/guidelines/22/#navigable)
## Guideline 2.5 Input Modalities: Make it easier for users to operate functionality through various inputs beyond keyboard
The conformance criteria under this guideline ensures that users are able to interact with digital technology using different input methods beyond a keyboard or mouse (including touchscreen, voice, device motion, or alternative input devices).
<table>
<thead>
<tr>
<th scope="col">Success criteria</th>
<th scope="col">How to conform to the criteria</th>
<th scope="col">Practical resource</th>
</tr>
</thead>
<tbody>
<tr>
<td>2.5.1 Pointer Gestures (A)</em></td>
<td>All functionality that can be operated with a pointer can be operated with single-point actions. Path-based or multi-point gestures are not required to operate any functionality. Exceptions exist.</td>
<td><a href="https://www.w3.org/WAI/WCAG21/Understanding/pointer-gestures.html">Understanding Pointer Gestures</a></td>
</tr>
<tr>
<td>2.5.2 Pointer Cancellation (A)</em></td>
<td>For functionality that can be operated using a single-pointer at least one of the following is true: no down-event, abort/undo, up reversal or essential.</td>
<td><a href="https://www.w3.org/WAI/WCAG21/Understanding/pointer-cancellation.html">Understanding Pointer Cancellation</a></td>
</tr>
<tr>
<td>2.5.3 Label in Name (A)</em></td>
<td>For each user interface component that includes a visible text label, make sure the accessible name matches (or includes) the visible text in the label.</td>
<td><a href="https://www.w3.org/WAI/WCAG21/Understanding/label-in-name.html">Understanding Label in Name</a></td>
</tr>
<tr>
<td>2.5.4 Motion Actuation (A)</em></td>
<td>Ensure that for functionality that can be triggered by a) device motion (like shaking, tilting) or b) user gestures detected by device sensors (including a camera) that both of the following are true: 1) motion actuation can be disabled, and 2) the functionality can be operated without using device motion or user gestures. Exceptions exist.</td>
<td><a href="https://www.w3.org/WAI/WCAG21/Understanding/motion-actuation.html">Understanding Motion Actuation</a></td>
</tr>
<tr>
<td>2.5.5 Target Size (AAA)</td>
<td>The size of an actionable item's touch target must be at least 44 CSS pixels in both width and height. Exceptions exist.</td>
<td><a href="https://www.w3.org/WAI/WCAG21/Understanding/target-size.html">Understanding Target Size</a></td>
</tr>
<tr>
<td>2.5.6 Concurrent Input Mechanisms (AAA)</td>
<td>Make sure people can use and switch between different modes of input when interacting with digital content including touchscreen, keyboard, mouse, voice commands, or alternative input devices. An essential exception exists. </td>
<td><a href="https://www.w3.org/WAI/WCAG21/Understanding/concurrent-input-mechanisms.html">Understanding Concurrent Input Mechanism</a></td>
</tr>
<tr>
<td> 2.5.8 Target size minimum (AA)</td>
<td> Target size for pointer inputs should be at least <code>24px</code> wide by <code>24px</code> tall except for the following areas:
<ul>
<li> <strong>Spacing:</strong>Targets that are less than <code>24px x 24px</code> are positioned so that if a <code>24px</code> diameter circle is centered on each target's bounding box, the circles do not intersect with any other target or the circle for another undersized target.</li>
<li> <strong>Equivalent:</strong> A separate control that achieves the same function that meets this standard is available on the same page.</li>
<li> <strong>Inline:</strong> The target is located within a line of text with its size constrained by the line height or surrounding non-target text.</li>
<li> <strong>User agent control:</strong> The target's size is determined by the user agent and has not been modified by the author.</li>
<li> <strong>Essential:</strong> A particular presentation of the target is essential or legally required for the information being conveyed.</li>
</ul>
<td> Check out <a href="https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html">Understanding target size minimum</a> </td>
</tr>
</tr>
</tbody>
</table>
> [!NOTE]
> Also see the WCAG description for [Guideline 2.5: Input Modalities: Make it easier for users to operate functionality through various inputs beyond keyboard.](https://w3c.github.io/wcag/guidelines/22/#input-modalities)
## See also
- [WCAG](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG)
1. [Perceivable](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Perceivable)
2. Operable
3. [Understandable](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Understandable)
4. [Robust](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Robust)
|
---
title: Understandable
slug: Web/Accessibility/Guides/Understanding_WCAG/Understandable
page-type: guide
sidebar: accessibilitysidebar
---
This article provides practical advice on how to write your web content so that it conforms to the success criteria outlined in the **Understandable** principle of the Web Content Accessibility Guidelines (WCAG) 2.0 and 2.1. Understandable states that information and the operation of user interface must be understandable.
> [!NOTE]
> To read the W3C definitions for Understandable and its guidelines and success criteria, see [Principle 3: Understandable β Information and the operation of user interface must be understandable](https://w3c.github.io/wcag/guidelines/22/#understandable).
## Guideline 3.1 β Readable: Make text content readable and understandable
This guideline focuses on making text content as understandable as possible.
<table class="standard-table">
<thead>
<tr>
<th scope="col">Success criteria</th>
<th scope="col">How to conform to the criteria</th>
<th scope="col">Practical resource</th>
</tr>
</thead>
<tbody>
<tr>
<td>3.1.1 Language of Page (A)</td>
<td>
The default human language of each web page should be detectable via
code. This is essential for purposes like making sure the reader has
arrived at a page written in a language suitable for them. The simplest
way to achieve this is to set the <a href="/en-US/docs/Web/HTML/Reference/Global_attributes/lang">lang</a>
attribute on the page's {{htmlelement("html")}} element, giving
it a value equal to the language code that best represents the language
the page is written in.
</td>
<td>
See
<a
href="/en-US/docs/Learn_web_development/Core/Structuring_content/Webpage_metadata#setting_the_primary_language_of_the_document"
>Setting the primary language of the document</a
>.
</td>
</tr>
<tr>
<td>3.1.2 Language of Parts (AA)</td>
<td>
<p>
In cases where the content of a page includes words or phrases that
are in a different language to the primary language, use the
<a href="/en-US/docs/Web/HTML/Reference/Global_attributes/lang">lang</a> attribute on an element wrapped
around the term in question (e.g., a {{htmlelement("span")}}
if no semantic element is available) to set an appropriate language
for it.
</p>
<p>
You don't need to set a different language for words or phrases that
are the same regardless of language (for example proper names,
technical terms that aren't part of a specific language).
</p>
</td>
<td></td>
</tr>
<tr>
<td>3.1.3 Unusual Words (AAA)</td>
<td>
Where technical terms, jargon, or idioms/slang are used, definitions
should be provided for such phrases/words. Your site should provide a
glossary that contains definitions of such words/terms that you can then
link to when they appear, or at the very least provide definitions
somewhere in the surrounding text, or in a
<a
href="/en-US/docs/Learn_web_development/Core/Structuring_content/Lists#description_lists"
>description list</a
>
at the bottom of the page.
</td>
<td></td>
</tr>
<tr>
<td>3.1.4 Abbreviations (AAA)</td>
<td>
<p>
Where abbreviations are used, you should provide an expansion of them,
or a definition as required.
</p>
<p>
The {{htmlelement("abbr")}} element is often thought of as
the preferred way to provide an expansion for an abbreviation β it
takes a <a href="/en-US/docs/Web/HTML/Reference/Global_attributes/title">title</a> attribute that contains the
expansion, and this appears when the acronym is moused over. However,
the title contents are not accessible via keyboard, nor are they
reliably read out by screen readers. A better way to handle this is to
again provide links to glossary pages containing the acronym expansion
and explanation, or at the very least include them in the surrounding
text in context.
</p>
</td>
<td>
See
<a
href="/en-US/docs/Learn_web_development/Core/Structuring_content/Advanced_text_features#abbreviations"
>Abbreviations</a
>.
</td>
</tr>
<tr>
<td>3.1.5 Reading Level (AAA)</td>
<td>
<p>
If text is provided that requires a higher reading level that lower
secondary education level (typically children around 11-14 years old),
provide supplementary explainer material to help people who can't read
it, or provide an alternative version that is written at lower
secondary level.
</p>
<p>
This doesn't mean that all subject matter should be understood by
everyone, but that the style of writing should be accessible by
everyone. It is better to just write all content at lower secondary
level, even technical documentation like programming tutorials, unless
there is a good reason not to (e.g., an alternative style for poetic
effect), or they have to be written in a strict style (e.g., W3C
specs).
</p>
</td>
<td></td>
</tr>
<tr>
<td>3.1.6 Pronunciation (AAA)</td>
<td>
<p>
A mechanism should be provided to give users access to pronunciation
of words where they are is needed to understand the content fully.
</p>
<p>
The HTML {{htmlelement("audio")}} element can be used to
create a control that allows the reader to play back an audio file
containing the correct pronunciation, and it also makes sense to
include a textual pronunciation guide after difficult words, in the
same way that you find in dictionary entries.
</p>
</td>
<td>
See
<a
href="/en-US/docs/Learn_web_development/Core/Structuring_content/HTML_video_and_audio"
>Video and audio content</a
>, and
<a
href="https://www.oxfordlearnersdictionaries.com/us/about/pronunciation_english.html"
>Pronunciation Guide for English Dictionary</a
>
</td>
</tr>
</tbody>
</table>
> [!NOTE]
> Also see the WCAG description for [Guideline 3.1 Readable: Make text content readable and understandable](https://w3c.github.io/wcag/guidelines/22/#readable).
## Guideline 3.2 β Predictable: Make Web pages appear and operate in predictable ways
This guideline focuses on making user interfaces intuitive and understandable.
<table class="standard-table">
<thead>
<tr>
<th scope="col">Success criteria</th>
<th scope="col">How to conform to the criteria</th>
<th scope="col">Practical resource</th>
</tr>
</thead>
<tbody>
<tr>
<td>3.2.1 On Focus (A)</td>
<td>
<p>
When a control or other page feature receives focus, it should not
change the context in a way that may confuse or disorientate the user.
</p>
<p>
This is a matter of sensible design β people don't want interfaces to
surprise them; they want things to be intuitive and behave as
expected. For example, focusing a navigation menu option should not
change the displayed page β it should be activated before the display
changes.
</p>
</td>
<td>
<code>Element</code>'s {{domxref("Element.focus_event", "focus")}} event contains some
useful information. Also see
<a
href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#building_keyboard_accessibility_back_in"
>Building keyboard accessibility back in</a
>
for some useful implementation ideas.
</td>
</tr>
<tr>
<td>3.2.2 On Input (A)</td>
<td>
<p>
When data is inputted into a control, or a setting is changed, context
should not be changed unexpectedly. The user should be warned/advised
of the impending change before it occurs.
</p>
<p>
Again, sensible design should be implemented. For example, if pressing
a button causes the application to exit the current view, the user
should be asked to confirm this action, save their work if
appropriate, etc.
</p>
</td>
<td>
The {{domxref("Element/input_event", "input")}} event is useful here.
</td>
</tr>
<tr>
<td>3.2.3 Consistent Navigation (AA)</td>
<td>
<p>
Navigation menu/control style and positioning should be consistent
between different pages or views of a web page, and the existing items
should appear in the same order, even if for example new items are
added. If the user has initiated a change, e.g., choosing a different
color scheme or position for the navigation, their choice should be
respected across all pages.
</p>
<p>
Again, sensible design β make the navigation controls the same across
all pages or views.
</p>
</td>
<td>
See
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#structure_page_sections_logically"
>Structure page sections logically</a
>
for information on modern markup for layouts. See also
<a
href="/en-US/docs/Learn_web_development/Core/Text_styling/Styling_links#styling_links_as_buttons"
>Styling links as buttons</a
>
for a useful accessible navigation menu example.
</td>
</tr>
<tr>
<td>3.2.4 Consistent Identification (AA)</td>
<td>
<p>
Controls or components that have the same functionality should be
identified in the same way across different pages or views. A currency
converter appearing on every page of a world travel site for example
should be exactly the same, semantically and in terms of labels.
</p>
<p>Again, sensible design!</p>
</td>
<td>
"Labels" can refer to descriptive information in text content, or HTML
form labels. See
<a href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#use_meaningful_text_labels"
>Use meaningful text labels</a
>
for more information.
</td>
</tr>
<tr>
<td>3.2.5 Change on Request (AAA)</td>
<td>
<p>
Changes in context that could possibly confuse or disorient users
should only occur only when requested by the user, OR the user should
be able to turn them off.
</p>
<p>
If you need to have something that significantly changes the current
view (e.g., content or controls), let the user control when they want
that change to occur (e.g., what page to show, when to advance to the
next photo in the gallery...)
</p>
<p>
If you need to have something like a carousel on a page, provide an
option to stop it automatically advancing. Better to avoid such
functionality if possible.
</p>
</td>
</tr>
<tr>
<td> 3.2.6 Consistent help (A)</td>
<td> <p> Web pages that contain help mechanisms, including self-help options and human contact details, that are repeated on multiple web pages, need to place those mechanisms in the same order on all pages, unless a change is initiated by the user.</p>
<td> <p> Check out the <a href="https://www.w3.org/WAI/WCAG22/Understanding/consistent-help">consistent help documentation</a> for this standard to learn more. </p>
</td>
</td>
<tr>
</tr>
</tbody>
</table>
> [!NOTE]
> Also see the WCAG description for [Guideline 3.2 Predictable: Make Web pages appear and operate in predictable ways](https://w3c.github.io/wcag/guidelines/22/#predictable).
## Guideline 3.3 β Input Assistance: Help users avoid and correct mistakes
This guideline centers around helping users enter correct information when required with the minimum of mistakes.
<table class="standard-table">
<thead>
<tr>
<th scope="col">Success criteria</th>
<th scope="col">How to conform to the criteria</th>
<th scope="col">Practical resource</th>
</tr>
</thead>
<tbody>
<tr>
<td>3.3.1 Error Identification (A)</td>
<td>
<p>
When a user is filling out a form or choosing between options, any
error that is detected should be clearly reported to the user, along
with the form control that the error relates to.
</p>
<p>
It is advisable to implement client-side error detection and handling,
via HTML form validation features, and/or JavaScript, whatever is
best for your situation. When an error is detected, an intuitive error
message should be shown next to the form input that is at fault to
help the user correct their inputs. For screen reader users, you can
use aria live regions to alert the user to a change on the page.
</p>
<div class="note notecard">
<p>
<strong>Note:</strong> Server-side validation should <em>always</em> be
used alongside client-side validation. Client-side validation is too
easy to turn off or otherwise get around, so it can't be relied on
alone.
</p>
</div>
</td>
<td>
See
<a href="/en-US/docs/Learn_web_development/Extensions/Forms/Form_validation"
>Form data validation</a
>
for comprehensive validation information, and
<a
href="/en-US/docs/Learn_web_development/Core/Accessibility/WAI-ARIA_basics#dynamic_content_updates"
>WAI-ARIA: Dynamic content updates</a
>
for information on live regions.
</td>
</tr>
<tr>
<td>3.3.2 Labels or Instructions (A)</td>
<td>
<p>
Clear instructions should be provided when data input is required.
When a short instruction or prompt is required, you can use
{{htmlelement("label")}} elements for single inputs like name
or age, a combination or {{htmlelement("label")}}s and
{{htmlelement("fieldset")}}s/{{htmlelement("legend")}}s
for multiple inputs that go together (like the elements of a date of
birth or postal address).
</p>
<p>
When more complex explanation is required, you can always include
explanatory paragraphs too, or maybe you need to try to make your
forms more intuitive.
</p>
</td>
<td>
<ul>
<li>
<a
href="/en-US/docs/Learn_web_development/Core/Accessibility/HTML#use_meaningful_text_labels"
>Use meaningful text labels</a
>
</li>
<li>
<a href="/en-US/docs/Learn_web_development/Extensions/Forms/How_to_structure_a_web_form"
>How to structure an HTML form</a
>
</li>
<li>
<a
href="/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Text_labels_and_names"
>Text labels and names</a
>
</li>
</ul>
</td>
</tr>
<tr>
<td>3.3.3 Error Suggestion (AA)</td>
<td>
<p>
When an error is detected and suggestions for correction are known,
provide these to the user (e.g., suggesting alternatives when the user
is choosing a user name and has selected one that is already taken),
unless doing so would cause a security issue (e.g., when entering a
password) or context problem (e.g., they are trying to answer a
question in a quiz app).
</p>
<p>
In such cases, when this is appropriate, you'll probably use a
combination of JavaScript and server-side functionality to check if
the entry is correct, and if not, what viable suggestions can be given
to the user. Such suggestions should be displayed usefully in context,
just like error messages (see 3.3.1).
</p>
</td>
<td>No tutorial suggestions yet.</td>
</tr>
<tr>
<td>3.3.4 Error Prevention (Legal, Financial, Data) (AA)</td>
<td>
<p>
In the case of forms involved with entry of sensitive data (such as
legal agreements, e-commerce transactions, or personal data), at least
one of the following should be true:
</p>
<ul>
<li>Submissions are reversible.</li>
<li>
Data is checked for errors, and the user is given an opportunity to
correct them.
</li>
<li>
A mechanism is available for confirming and correcting information
before final submission.
</li>
</ul>
</td>
<td>
<p>
<strong>Reversible</strong> β for any view where data can be entered,
provide an equivalent view that allows you to edit or even delete an
entry, as appropriate (for example, see
<a href="/en-US/docs/Learn_web_development/Extensions/Server-side/Django">Django web framework</a
>).
</p>
<p>
<strong>Checking data</strong> β as covered in 3.3.1, a combination of
client-side and server-side validation should be used to detect errors
and display helpful messages to the user to allow them to correct
their inputs.
</p>
<p>
<strong>Confirm and correct</strong> β where appropriate, after
filling in a series of form fields to perform a task (such as buying a
product), the user should be shown a confirmation screen where they
can review their inputs and correct anything that doesn't look right.
This pattern is commonly used on e-commerce sites like Amazon.
</p>
</td>
</tr>
<tr>
<td>3.3.5 Context-sensitive help is available (AAA)</td>
<td>
Provide instructions and other appropriate cues in context to aid form
completion and submission.
</td>
<td>
This really just builds on 3.3.1 and other similar criteria but requires
more thorough contextual help information and services, e.g., providing a
dedicated link to a help page or service on each page, providing
examples showing what successful completion should look like.
</td>
</tr>
<tr>
<td>3.3.6 Error Prevention (All) (AAA)</td>
<td>
This principle builds on 3.3.4, extending its requirements to all user
input situations, not just ones involving sensitive data.
</td>
<td>Again, see 3.3.4.</td>
</tr>
<tr>
<td> 3.3.7 Redundant entry (A) </td>
<td>
Information that is required that was previously entered or provided by the user in the same process or user flow is either auto-populated or made selectable to the user from a list of options, unless re-entering the information is essential or required for security reasons, or if the information is no longer valid.
</td>
<td>Check out <a href="https://www.w3.org/WAI/WCAG22/Understanding/redundant-entry">Understanding redundant entry</a> to learn more.</td>
</tr>
<tr>
<td> 3.3.8 Accessible authentication (Minimum) (AA)
</td>
<td>
Cognitive function tests, like remembering a password, are not required for any step in an authentication process unless an alternative is provided, such as an object or personal content (e.g., images, videos, and audio) recognition, or a mechanism to assist (e.g., copy and paste and autosave passwords).
</td>
<td> Check out the <a href="https://www.w3.org/WAI/WCAG22/Understanding/accessible-authentication-minimum"> accessible authentication documentation</a> for this standard to learn more. </td>
</tr>
<tr>
<td> 3.3.9 Accessible Authentication (Enhanced) (AAA) </td>
<td>
A cognitive function test, like remembering a password, must not be required for any step in an authentication process without providing an alternative that does not rely on a cognitive function test or provides a mechanism to assist the user in completing the cognitive function test. Authentication tests that require the user to recognize objects or identify non-text content the user provided to the website are allowed.
</td>
<td> Check out the <a href="https://www.w3.org/WAI/WCAG22/Understanding/accessible-authentication-enhanced">enhanced accessible authentication documentation (AAA)</a> to learn more.</td>
</tr>
</tbody>
</table>
> [!NOTE]
> Also see the WCAG description for [Guideline 3.3 Input Assistance: Help users avoid and correct mistakes](https://w3c.github.io/wcag/guidelines/22/#input-assistance).
## See also
- [WCAG](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG)
1. [Perceivable](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Perceivable)
2. [Operable](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Operable)
3. Understandable
4. [Robust](/en-US/docs/Web/Accessibility/Guides/Understanding_WCAG/Robust)
|
---
title: Accessibility information for web authors
short-title: Information for web authors
slug: Web/Accessibility/Guides/Information_for_Web_authors
page-type: guide
sidebar: accessibilitysidebar
---
This document lists guidelines and regulations, how-to's, and tools for checking and repairing accessibility problems with websites.
## Guidelines and Regulations
- [<abbr>ARIA</abbr> Authoring Practices Guide (<abbr>APG</abbr>)](https://www.w3.org/WAI/ARIA/apg/)
- : Guide to accessibility semantics defined by the Accessible Rich Internet Application (<abbr>ARIA</abbr>) specification to create accessible web experiences. Describes how to apply accessibility semantics to common design patterns and widgets, providing design patterns and functional examples.
- [Web Content Accessibility Guidelines (<abbr>WCAG</abbr>)](https://www.w3.org/WAI/standards-guidelines/wcag/)
- : Another important set of guidelines from the W3C _Web Accessibility Initiative (<abbr>WAI</abbr>)_. The European Union is looking to base their upcoming accessibility regulations on these guidelines. These guidelines are discussed on the [<abbr>WAI</abbr> interest group discussion list](https://www.w3.org/WAI/about/groups/waiig/#mailinglist).
- [ARIA on this site](/en-US/docs/Web/Accessibility/ARIA)
- : <abbr>MDN</abbr> guide to all the [ARIA roles](/en-US/docs/Web/Accessibility/ARIA/Reference/Roles) and [ARIA properties](/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes), including best practices, related roles and properties, and examples.
## How-to's
- [Accessibility for teams](https://digital.gov/guides/accessibility-for-teams/)
- : A brief guide from the U.S. General Services administration's Technology Transformation Services covering several accessibility topics with links to "how-to" videos and to related WCAG references.
- [Accessible Web Page Authoring](https://www.ibm.com/able/requirements/requirements/)
- : IBM has made their accessibility requirements that need to be met public and interactive.
## Automated Checking & Repair
Use a tool to quickly check for common errors in your browser.
- [HTML CodeSniffer](https://squizlabs.github.io/HTML_CodeSniffer/)
- [aXe](https://chromewebstore.google.com/detail/axe-devtools-web-accessib/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)
- [Lighthouse Accessibility Audit](https://developer.chrome.com/docs/lighthouse/overview/)
- [Accessibility Insights](https://accessibilityinsights.io/)
- [<abbr>WAVE</abbr>](https://wave.webaim.org/extension/)
Tools to integrate into your build process, programmatically adding accessibility tests, so you can catch errors as you develop your web application:
- [axe-core](https://github.com/dequelabs/axe-core)
- [jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)
- [Lighthouse Audits](https://github.com/GoogleChrome/lighthouse/blob/main/docs/readme.md#using-programmatically)
- [AccessLint.js](https://github.com/accesslint/accesslint.js/tree/master)
{{glossary("Continuous integration")}} tools to find accessibility issues in your GitHub pull requests:
- [AccessLint](https://accesslint.com/)
While best to test your web applications with real users, you can simulate color blindness, low vision, low and contrast, and zooming. You should always test your site with out a mouse and touch to test keyboard navigation. You may also want to try your site using voice commands. Try disabling your mouse and using browser extensions like [Web Disability Simulator](https://chromewebstore.google.com/detail/web-disability-simulator/olioanlbgbpmdlgjnnampnnlohigkjla)
|
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 15