Skip to content

Commit

Permalink
rule: SC 1.2.3 & 1.2.5 Video alternatives (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoFiers authored and jeeyyy committed Jan 22, 2019
1 parent f337be9 commit 604b172
Show file tree
Hide file tree
Showing 11 changed files with 564 additions and 77 deletions.
4 changes: 2 additions & 2 deletions _rules/SC1-2-1-audio-transcript.md
Expand Up @@ -20,15 +20,15 @@ authors:

### Applicability

The rule applies to any [non-streaming](#non-streaming-media-element) `audio` element that is:
The rule applies to every [non-streaming](#non-streaming-media-element) `audio` element that is:
- playing; or,
- has a "play button" that is [visibile](#visible) and [included-in-the-accessibility-tree](#included-in-the-accessibility-tree).

**Note:** A play button is an interactive element that when activated, plays the audio.

### Expectation

The auditory information of each test target is available through a text transcript that is available either on the page or through a link. The text transcript needs to be [visibile](#visible) and [included-in-the-accessibility-tree](#included-in-the-accessibility-tree).
The auditory information of each test target is available through a text transcript. That text transcript is [visibile](#visible) and [included-in-the-accessibility-tree](#included-in-the-accessibility-tree), either on the page or through a link.

**Note**: A "text transcript" in the context of this rule is defined in WCAG 2 as an [alternative for time based media](https://www.w3.org/TR/WCAG21/#dfn-alternative-for-time-based-media).

Expand Down
3 changes: 2 additions & 1 deletion _rules/SC1-2-1-media-alternative-audio.md
Expand Up @@ -20,7 +20,8 @@ authors:

### Applicability

The rule applies to any [non-streaming](#non-streaming-media-element) `audio` element that is:

The rule applies to every [non-streaming](#non-streaming-media-element) `audio` element that is:
- playing; or,
- has a "play button" that is [visibile](#visible) and [included-in-the-accessibility-tree](#included-in-the-accessibility-tree).

Expand Down
2 changes: 1 addition & 1 deletion _rules/SC1-2-1-media-alternative-video.md
Expand Up @@ -20,7 +20,7 @@ authors:

### Applicability

The rule applies to any [non-streaming](#non-streaming) `video` element that is [visible](#visible), where the video doesn't contain audio.
The rule applies to every [non-streaming](#non-streaming) `video` element that is [visible](#visible), where the video doesn't contain audio.

### Expectation 1

Expand Down
2 changes: 1 addition & 1 deletion _rules/SC1-2-2-video-has-audio-alternative.md
Expand Up @@ -23,7 +23,7 @@ authors:

### Applicability

The rule applies to any [non-streaming][#non-streaming-media-element] `video` element that is [visible on the page](#visible-on-the-page), where the video contains audio.
The rule applies to every [non-streaming][#non-streaming-video-element] `video` element that is [visible](#visible), where the video contains audio.

### Expectation

Expand Down
2 changes: 1 addition & 1 deletion _rules/SC1-2-2-video-has-captions.md
Expand Up @@ -21,7 +21,7 @@ authors:

### Applicability

The rule applies to any [non-streaming](#non-streaming) `video` element [visible on the page](#visible-on-the-page) where the video contains [audio](#audio).
The rule applies to every [non-streaming](#non-streaming) `video` element thst is [visible](#visible) where the video contains [audio](#audio).

### Expectation

Expand Down
183 changes: 183 additions & 0 deletions _rules/SC1-2-3-video-alternative.md
@@ -0,0 +1,183 @@
---
name: video with audio has audio descriptions or transcript
rule_type: composite
description: |
This rule checks video elements with audio have an alternative for the video content as audio or as text.
success_criterion:
- 1.2.3 # Audio Description or Media Alternative (Prerecorded)

atomic_rules:
- SC1-2-video-audio-description
- SC1-2-video-transcript
- SC1-2-video-description-track
- SC1-2-video-media-alternative

authors:
- Wilco Fiers
- Brian Bors
---

## Test Procedure

### Applicability

The rule applies to every [non-streaming](#non-streaming) `video` element that is [visible](#visible), where the video contains audio.

### Expectation

For each test target, the outcome of at least one of the following rules is passed:

- [Video element audio described](https://auto-wcag.github.io/auto-wcag/rules/SC1-2-video-audio-description.html)
- [Video element transcript](https://auto-wcag.github.io/auto-wcag/rules/SC1-2-video-transcript.html)
- [Video element description track](https://auto-wcag.github.io/auto-wcag/rules/SC1-2-video-description-track.html)
- [Video as a media alternative for text](https://auto-wcag.github.io/auto-wcag/rules/SC1-2-video-media-alternative.html)

## Assumptions

This rule assumes that a mechanism is available to start the video and that the video element is not simply used to display the [poster](https://www.w3.org/TR/html5/semantics-embedded-content.html#element-attrdef-video-poster).

## Accessibility support

See [Video element description track: accessibility support](https://auto-wcag.github.io/auto-wcag/rules/SC1-2-Video-description-track.html#accessibility-support.html).
See [Video with audio has audio description: accessibility support](https://auto-wcag.github.io/auto-wcag/rules/SC1-2-video-audio-description.html#accessibility-support.html).

## Background

- [Understanding Success Criterion 1.2.5: Audio Description (Prerecorded)
](https://www.w3.org/WAI/WCAG21/Understanding/audio-description-prerecorded.html)
- [G78: Providing a second, user-selectable, audio track that includes audio descriptions
](https://www.w3.org/TR/2016/NOTE-WCAG20-TECHS-20161007/G78)
- [H96: Using the track element to provide audio descriptions
](https://www.w3.org/WAI/GL/2016/WD-WCAG20-TECHS-20160105/H96)
- [G173: Providing a version of a movie with audio descriptions
](https://www.w3.org/TR/2016/NOTE-WCAG20-TECHS-20161007/G173)
- [G8: Providing a movie with extended audio descriptions
](https://www.w3.org/TR/2016/NOTE-WCAG20-TECHS-20161007/G8)

## Test Cases

### Passed

#### Pass example 1

A video element with a voiceover that describes the visual information.

```html
<video controls>
<source src="../test-assets/rabbit-video/video-with-voiceover.mp4" type="video/mp4"/>
<source src="../test-assets/rabbit-video/video-with-voiceover.webm" type="video/webm"/>
</video>
```

#### Pass example 2

A video element with a link to a text transcript.

```html
<video controls>
<source src="../test-assets/rabbit-video/video.mp4" type="video/mp4" />
<source src="../test-assets/rabbit-video/video.webm" type="video/webm"/>
</video>
<a href="../test-assets/rabbit-video/transcript.html">Transcript</p>
```

#### Pass example 3

A video element with a track element that contains descriptions.

```html
<video controls>
<source src="../test-assets/rabbit-video/video.mp4" type="video/mp4"/>
<source src="../test-assets/rabbit-video/video.webm" type="video/webm"/>
<track kind="descriptions" src="../test-assets/rabbit-video/descriptions.vtt"/>
</video>
```

#### Pass example 4

A video element that describes some of the text on the same page. The text on the page labels the video as an alternative.

```html
<p>Not being able to use your computer because your mouse
doesn't work, is frustrating. Many people use only the keyboard to navigate
websites. Either through preference or circumstance. This is solved by keyboard compatibility.
Keyboard compatibility is described in WCAG.
See the video below to watch the same information again in video form.</p>
<video src="../test-assets/perspective-video/perspective-keyboard-compatibility-video.mp4" controls>
</video>
```

### Failed

#### Fail example 1

A video element with an incorrect audio description.

```html
<video controls>
<source src="../test-assets/rabbit-video/video-with-incorrect-voiceover.mp4" type="video/mp4"/>
<source src="../test-assets/rabbit-video/video-with-incorrect-voiceover.webm" type="video/webm"/>
</video>
```

#### Fail example 2

A video element with a link to an incorrect text transcript on a different page.

```html
<video controls>
<source src="../test-assets/rabbit-video/video.mp4" type="video/mp4" />
<source src="../test-assets/rabbit-video/video.webm" type="video/webm" />
</video>
<a href="../test-assets/rabbit-video/incorrect-transcript.html">Transcript</p>
```

#### Fail example 3

A video element with a track element that contains incorrect descriptions.

```html
<video controls>
<source src="../test-assets/rabbit-video/video.mp4" type="video/mp4" />
<source src="../test-assets/rabbit-video/video.webm" type="video/webm" />
<track kind="descriptions" src="../test-assets/rabbit-video/incorrect-descriptions.vtt">
</video>
```

#### Fail example 4

A video element that describes some of the text on the same page. The video contains more information than the text does.

```html
<p>Not being able to use your computer because your mouse
doesn't work, is frustrating. Either through preference or circumstance. This is solved by keyboard compatibility.
Keyboard compatibility is described in WCAG.
See the video below to watch the same information again in video form.</p>
<video src="../test-assets/perspective-video/perspective-keyboard-compatibility-video.mp4" controls>
</video>
```

### Inapplicable

#### Inapplicable example 1

A video element without audio.

```html
<video controls>
<source src="../test-assets/rabbit-video/silent.mp4" type="video/mp4" />
<source src="../test-assets/rabbit-video/silent.webm" type="video/webm" />
</video>
```

#### Inapplicable example 2

A video element that is not visible on the page.

```html
<video controls style="display: none;">
<source src="../test-assets/rabbit-video/video.mp4" type="video/mp4" />
<source src="../test-assets/rabbit-video/video.webm" type="video/webm" />
</video>
```
151 changes: 151 additions & 0 deletions _rules/SC1-2-5-video-audio-alternative.md
@@ -0,0 +1,151 @@
---
name: video with audio has audio description
rule_type: composite
description: |
This rule checks video elements with audio have audio description
success_criterion:
- 1.2.5 # Audio Description (Prerecorded)§

atomic_rules:
- SC1-2-video-audio-description
- SC1-2-video-media-alternative
- SC1-2-video-description-track

authors:
- Wilco Fiers
- Brian Bors
---

## Test Procedure

### Applicability

The rule applies to every [non-streaming](#non-streaming) `video` element that is [visible](#visible), where the video contains audio.

### Expectation

For each test target, the outcome of at least one of the following rules is passed:

- [Video element audio described](https://auto-wcag.github.io/auto-wcag/rules/SC1-2-video-audio-description.html)
- [Video element description track](https://auto-wcag.github.io/auto-wcag/rules/SC1-2-video-description-track.html)
- [Video as a media alternative for text](https://auto-wcag.github.io/auto-wcag/rules/SC1-2-video-media-alternative.html)

## Assumptions

This rule assumes that a mechanism is available to start the video and that the video element is not simply used to display the [poster](https://www.w3.org/TR/html5/semantics-embedded-content.html#element-attrdef-video-poster).

## Accessibility support

See [Video element description track: accessibility support](https://auto-wcag.github.io/auto-wcag/rules/SC1-2-Video-description-track.html#accessibility-support).
See [Video with audio has audio description: accessibility support](https://auto-wcag.github.io/auto-wcag/rules/SC1-2-video-audio-description.html#accessibility-support).

## Background

- [Understanding Success Criterion 1.2.5: Audio Description (Prerecorded)](https://www.w3.org/WAI/WCAG21/Understanding/audio-description-prerecorded.html)
- [G78: Providing a second, user-selectable, audio track that includes audio descriptions](https://www.w3.org/TR/2016/NOTE-WCAG20-TECHS-20161007/G78)
- [H96: Using the track element to provide audio descriptions](https://www.w3.org/WAI/GL/2016/WD-WCAG20-TECHS-20160105/H96)
- [G173: Providing a version of a movie with audio descriptions](https://www.w3.org/TR/2016/NOTE-WCAG20-TECHS-20161007/G173)
- [G8: Providing a movie with extended audio descriptions](https://www.w3.org/TR/2016/NOTE-WCAG20-TECHS-20161007/G8)

## Test Cases

### Passed

#### Pass example 1

A video element with a voiceover that describes the visual information.

```html
<video controls>
<source src="../test-assets/rabbit-video/video-with-voiceover.mp4" type="video/mp4"/>
<source src="../test-assets/rabbit-video/video-with-voiceover.webm" type="video/webm"/>
</video>
```

#### Pass example 2

A video element with a track element that contains descriptions.

```html
<video controls>
<source src="../test-assets/rabbit-video/video.mp4" type="video/mp4"/>
<source src="../test-assets/rabbit-video/video.webm" type="video/webm"/>
<track kind="descriptions" src="../test-assets/rabbit-video/descriptions.vtt"/>
</video>
```

#### Pass example 3

A video element that describes some of the text on the same page. The text on the page labels the video as an alternative.

```html
<p>Not being able to use your computer because your mouse
doesn't work, is frustrating. Many people use only the keyboard to navigate
websites. Either through preference or circumstance. This is solved by keyboard compatibility.
Keyboard compatibility is described in WCAG.
See the video below to watch the same information again in video form.</p>
<video src="../test-assets/perspective-video/perspective-keyboard-compatibility-video.mp4" controls>
</video>
```

### Failed

#### Fail example 1

A video element with an incorrect audio description.

```html
<video controls>
<source src="../test-assets/rabbit-video/video-with-incorrect-voiceover.mp4" type="video/mp4"/>
<source src="../test-assets/rabbit-video/video-with-incorrect-voiceover.webm" type="video/webm"/>
</video>
```

#### Fail example 2

A video element with a track element that contains incorrect descriptions.

```html
<video controls>
<source src="../test-assets/rabbit-video/video.mp4" type="video/mp4" />
<source src="../test-assets/rabbit-video/video.webm" type="video/webm" />
<track kind="descriptions" src="../test-assets/rabbit-video/incorrect-descriptions.vtt">
</video>
```

#### Fail example 3

A video element with a link to a text transcript.

```html
<video controls>
<source src="../test-assets/rabbit-video/video.mp4" type="video/mp4" />
<source src="../test-assets/rabbit-video/video.webm" type="video/webm"/>
</video>
<a href="../test-assets/rabbit-video/transcript.html">Transcript</p>
```

### Inapplicable

#### Inapplicable example 1

A video element without audio.

```html
<video controls>
<source src="../test-assets/rabbit-video/silent.mp4" type="video/mp4" />
<source src="../test-assets/rabbit-video/silent.webm" type="video/webm" />
</video>
```

#### Inapplicable example 2

A video element that is not visible on the page.

```html
<video controls style="display: none;">
<source src="../test-assets/rabbit-video/video.mp4" type="video/mp4" />
<source src="../test-assets/rabbit-video/video.webm" type="video/webm" />
</video>
```

0 comments on commit 604b172

Please sign in to comment.