Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 80f0bf - audio or video avoids automatically playing audio #1655

Open
wants to merge 52 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2c9e229
update audio or video avoids automatically playing audio
carlosapaduarte Jun 18, 2021
f0e2241
update type and description
carlosapaduarte Jun 18, 2021
728538c
update frontmatter
carlosapaduarte Jun 18, 2021
9ef2873
Revert "update frontmatter"
carlosapaduarte Jul 16, 2021
63b4d64
Revert "update type and description"
carlosapaduarte Jul 16, 2021
2cc646d
Revert "update audio or video avoids automatically playing audio"
carlosapaduarte Jul 16, 2021
500ebc9
deprecate no longer used rules
carlosapaduarte Jul 16, 2021
2ec57ce
update composite to atomic
carlosapaduarte Jul 16, 2021
f3035e0
update description of passed example 2
carlosapaduarte Jul 16, 2021
2e5d3d1
Replace expectation about the instrument being accessible with a back…
carlosapaduarte Jul 16, 2021
32cf772
Revert "Replace expectation about the instrument being accessible wit…
carlosapaduarte Sep 6, 2021
b12416b
Revert "update description of passed example 2"
carlosapaduarte Sep 6, 2021
63cfbf1
Revert "update composite to atomic"
carlosapaduarte Sep 6, 2021
eb43a2d
Deprecate the composite rule
carlosapaduarte Sep 6, 2021
b79d068
new atomic to replace the composite and two atomics
carlosapaduarte Sep 6, 2021
5d90f12
made editorial changes
carlosapaduarte Jan 17, 2022
1fbcd53
Merge branch 'develop' into update-80f0bf
carlosapaduarte Jan 17, 2022
1b3791b
Merge branch 'develop' into update-80f0bf
carlosapaduarte Jan 24, 2022
ee1e021
Update frontmatter of deprecated rules
carlosapaduarte Jan 24, 2022
ad6778b
Merge branch 'develop' into update-80f0bf
carlosapaduarte Feb 2, 2022
3a86ac0
Update _rules/audio-or-video-avoids-automatically-playing-audio-x0paj…
carlosapaduarte Feb 2, 2022
064b7f8
Replace mechanism with instrument in the assumptions
carlosapaduarte Feb 2, 2022
682fe7d
Update background headings
carlosapaduarte Feb 2, 2022
5c0fec1
Merge branch 'develop' into update-80f0bf
carlosapaduarte Feb 9, 2022
0a67ec7
Merge branch 'develop' into update-80f0bf
carlosapaduarte Feb 11, 2022
8af6aea
Merge branch 'develop' into update-80f0bf
carlosapaduarte Feb 16, 2022
6943774
Merge branch 'develop' into update-80f0bf
carlosapaduarte Feb 18, 2022
7bfbffe
Merge branch 'develop' into update-80f0bf
carlosapaduarte Feb 25, 2022
81b7f48
Merge branch 'develop' into update-80f0bf
carlosapaduarte Mar 8, 2022
a654300
Merge branch 'develop' into update-80f0bf
carlosapaduarte Mar 25, 2022
4fc3ff6
Update _rules/audio-or-video-avoids-automatically-playing-audio-x0paj…
carlosapaduarte Mar 30, 2022
f73fed1
Update _rules/audio-or-video-avoids-automatically-playing-audio-x0paj…
carlosapaduarte Mar 30, 2022
bd29173
Update _rules/audio-or-video-avoids-automatically-playing-audio-x0paj…
carlosapaduarte Mar 30, 2022
777d1f8
Update _rules/audio-or-video-avoids-automatically-playing-audio-x0paj…
carlosapaduarte Mar 30, 2022
2b17759
Update _rules/audio-or-video-avoids-automatically-playing-audio-x0paj…
carlosapaduarte Mar 30, 2022
de3e4f9
update example descriptions
carlosapaduarte Mar 30, 2022
3c05a2f
Removed examples checking different SC
carlosapaduarte Mar 30, 2022
51d8c1b
Remove unnecessary style
carlosapaduarte Mar 30, 2022
ec0521d
Remove outdated accessibility support note
carlosapaduarte Mar 30, 2022
42a68c3
Rephrased assumption
carlosapaduarte Mar 30, 2022
3b92b94
Merge branch 'develop' into update-80f0bf
carlosapaduarte May 13, 2022
4bb7d79
Add <dfn> to applicability conditions and update inapplicable examples
carlosapaduarte Jan 9, 2023
f53dad9
Add inapplicable example of long video with short audio, and test res…
carlosapaduarte Jan 9, 2023
2850665
Merge branch 'develop' into update-80f0bf
Jan 9, 2023
8b69d82
Update _rules/audio-or-video-avoids-automatically-playing-audio-x0paj…
Jan 13, 2023
83abb41
Update accessibility support note with further explanation
carlosapaduarte Jan 13, 2023
a5fd2da
Move and merge assumption note into background note
carlosapaduarte Jan 13, 2023
d060379
Replace MDN resource with WAI resource
carlosapaduarte Jan 13, 2023
07a01e5
Fix spelling
carlosapaduarte Jan 13, 2023
efa91bf
Update _rules/audio-or-video-avoids-automatically-playing-audio-x0paj…
Feb 8, 2023
f0eee9a
Merge branch 'develop' into update-80f0bf
Sep 14, 2023
af10ed2
Merge branch 'develop' into update-80f0bf
Jan 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 141 additions & 18 deletions _rules/audio-or-video-avoids-automatically-playing-audio-80f0bf.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
id: 80f0bf
name: '`audio` or `video` avoids automatically playing audio'
rule_type: composite
rule_type: atomic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this change requires us to deprecate the 3 previous rules, and have a new one.

description: |
This rule checks that audio or video that plays automatically does not have audio that lasts for more than 3 seconds or has an audio control mechanism to stop or mute it.
This rule checks that audio or video that plays automatically with audio that lasts for more than 3 seconds has an audio control mechanism to stop or mute it.
accessibility_requirements:
wcag20:1.4.2: # Audio Control (A)
forConformance: true
Expand Down Expand Up @@ -31,9 +31,11 @@ accessibility_requirements:
failed: not satisfied
passed: further testing needed
inapplicable: further testing needed
input_rules:
- 4c31df
- aaa1bf
input_aspects:
- DOM Tree
- CSS Styling
- Audio output
- Visual output
acknowledgments:
authors:
- Anne Thyme Nørregaard
Expand All @@ -51,20 +53,23 @@ This rule applies to any `audio` or `video` element for which all the following
- **autoplay**: the element has an `autoplay` [attribute value][] of `true`; and
- **not muted**: the element has a `muted` [attribute value][] of `false`; and
- **not paused**: the element has a `paused` [attribute value][] of `false`; and
- **duration**: the element has a [media resource][] lasting more than 3 seconds and that contains audio.
- **audio duration**: the element has a [media resource][] for which the audio output lasts more than 3 seconds.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems slightly ambiguous to me. Should we do this based on the duration property?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not work based on the duration because the media resource could have a duration longer than 3 seconds, while the audio in the media resource is shorter than 3 seconds.

What exactly is ambiguous in the current description?


## Expectation
## Expectation 1

For each test target, the [outcome](#outcome) of at least one of the following rules is passed:
For each test target, there is at least one [instrument][] in the same [web page][] to pause or stop the audio, or turn the audio volume off independently from the overall system volume control.

- [Audio Or Video That Plays Automatically Has A Control Mechanism](https://act-rules.github.io/rules/4c31df)
- [Audio Or Video That Plays Automatically Has No Audio That Lasts More Than 3 Seconds](https://act-rules.github.io/rules/aaa1bf)
## Expectation 2

The [instrument][] to pause or stop or turn the audio volume off is [visible](#visible), has an [accessible name](#accessible-name) that is not only [whitespace](#whitespace), and is [included in the accessibility tree](#included-in-the-accessibility-tree).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The [instrument][] to pause or stop or turn the audio volume off is [visible](#visible), has an [accessible name](#accessible-name) that is not only [whitespace](#whitespace), and is [included in the accessibility tree](#included-in-the-accessibility-tree).
The [instrument][] to pause or stop or turn the audio volume off is [visible](#visible), [included in the accessibility tree](#included-in-the-accessibility-tree), and it has an [accessible name](#accessible-name) that is not only [whitespace](#whitespace).

My preference, feel free to ignore.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think this expectation should go away in favour of #1632 (where I somehow seem to have forgotten to remove it 😖 )


## Assumptions

- This rule assumes that it is not possible to satisfy [Success Criterion 1.4.2 Audio Control][sc142] if the total length of the automatically playing audio is more than 3 seconds, even if there are pauses in the sound and no more than 3 seconds in a row with actual sound.
- This rule assumes that the [mechanism](https://www.w3.org/TR/WCAG21/#dfn-mechanism) to control the sound must be located in the same [web page][]. Mechanisms located on other pages can still create accessibility issues for users relying on sound to navigate (e.g. screen readers users) since the autoplaying sound will interfere with their ability to find and activate the mechanism. If a [mechanism](https://www.w3.org/TR/WCAG21/#dfn-mechanism) external to the [web page][] is provided, it is possible to fail this rule but still satisfy [Success Criterion 1.4.2 Audio Control][sc142].
- This rule assumes that the [mechanism](https://www.w3.org/TR/WCAG21/#dfn-mechanism) to control the sound must be visible and accessible in order to be effective and usable by all kinds of users. If the mechanism is hidden to some users, it is possible to fail this rule but still satisfy [Success Criterion 1.4.2 Audio Control][sc142].
This rule assumes that the [mechanism](https://www.w3.org/TR/WCAG21/#dfn-mechanism) to control the sound must be located in the same [web page][]. Mechanisms located on other pages can still create accessibility issues for users relying on sound to navigate (e.g. screen readers users) since the autoplaying sound will interfere with their ability to find and activate the mechanism. If a [mechanism](https://www.w3.org/TR/WCAG21/#dfn-mechanism) external to the [web page][] is provided, it is possible to fail this rule but still satisfy [Success Criterion 1.4.2 Audio Control][sc142].

This rule assumes that the [mechanism](https://www.w3.org/TR/WCAG21/#dfn-mechanism) to control the sound must be visible and accessible in order to be effective and usable by all kinds of users. If the mechanism is hidden to some users, it is possible to fail this rule but still satisfy [Success Criterion 1.4.2 Audio Control][sc142].

No [user style sheets](https://drafts.csswg.org/css-cascade/#cascade-origin-user) are used and no changes to the [user agent default style sheet](https://drafts.csswg.org/css-cascade/#cascade-origin-ua) are in place, otherwise the test cases might have different outcomes of the ones presented here.
Copy link
Collaborator

@ajanec01 ajanec01 Jul 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't that part go under the Test Cases heading to be in line with #1654 ? Otherwise approving.


## Accessibility Support

Expand All @@ -74,6 +79,8 @@ The native `video` and `audio` controls in several browser and assistive technol

- [Understanding Success Criterion 1.4.2: Audio Control](https://www.w3.org/WAI/WCAG21/Understanding/audio-control.html)
- [Accessible Multimedia](https://developer.mozilla.org/en-US/docs/Learn/Accessibility/Multimedia)
- [Failure of Success Criterion 1.4.2 for absence of a way to pause or stop an HTML5 media element that autoplays](https://www.w3.org/WAI/WCAG21/Techniques/failures/F93)
- [G170: Providing a control near the beginning of the Web page that turns off sounds that play automatically](https://www.w3.org/WAI/WCAG21/Techniques/general/G170)

## Test Cases

Expand All @@ -89,12 +96,12 @@ This `audio` element has an [instrument][] to pause, stop, or turn the audio vol

#### Passed Example 2

This `video` element does not play for longer than 3 seconds.
This `video` element has an [instrument][] to pause, stop, or turn the audio volume off.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This `video` element has an [instrument][] to pause, stop, or turn the audio volume off.
This `video` element has (in its default controls) an [instrument][] to pause it, an [instrument][] to stop it, and an [instrument][] to turn its audio volume off.


```html
<video autoplay>
<source src="/test-assets/rabbit-video/video.mp4#t=8,10" type="video/mp4" />
<source src="/test-assets/rabbit-video/video.webm#t=8,10" type="video/webm" />
<video autoplay controls>
<source src="/test-assets/rabbit-video/video.mp4" type="video/mp4" />
<source src="/test-assets/rabbit-video/video.webm" type="video/webm" />
</video>
```

Expand Down Expand Up @@ -145,14 +152,119 @@ This `audio` element autoplays, lasts for more than 3 seconds, and does not have

#### Failed Example 2

This `video` element audio autoplays for longer than 3 seconds, and does not have an [instrument][] to pause, stop, or mute the audio
This `video` element's audio autoplays for longer than 3 seconds, and does not have an [instrument][] to pause, stop, or mute the audio

```html
<video autoplay>
<source src="/test-assets/rabbit-video/video.mp4" type="video/mp4" />
<source src="/test-assets/rabbit-video/video.webm" type="video/webm" />
</video>
```
#### Failed Example 3

This `video` element has an [instrument][] to pause, stop, or turn the audio volume off but the [instrument][] is not visible.

```html
<head>
<style>
button {
color: #000;
display: none;
}
button:hover {
cursor: pointer;
cursor: pointer;
background-color: grey;
color: white;
}
</style>
</head>
<body>
<div id="video-container">
<!-- Video -->
<video id="video" autoplay>
<source src="/test-assets/rabbit-video/video.mp4" type="video/mp4" />
<source src="/test-assets/rabbit-video/video.webm" type="video/webm" />
</video>
<!-- Video Controls -->
<div id="video-controls">
<button type="button" id="play-pause" class="play">Pause</button>
<button type="button" id="mute">Mute</button>
</div>
</div>
<script src="/test-assets/80f0bf/no-autoplay.js"></script>
</body>
```

#### Failed Example 4

This `video` element has an [instrument][] to pause, stop, or turn the audio volume off but its `button` elements do not have accessible names.

```html
<head>
<style>
button {
color: #000;
}
button:hover {
cursor: pointer;
cursor: pointer;
background-color: grey;
color: white;
}
</style>
</head>
<body>
<div id="video-container">
<!-- Video -->
<video id="video" autoplay>
<source src="/test-assets/rabbit-video/video.mp4" type="video/mp4" />
<source src="/test-assets/rabbit-video/video.webm" type="video/webm" />
</video>
<!-- Video Controls -->
<div id="video-controls">
<button type="button" id="play-pause" class="play"></button>
<button type="button" id="mute"></button>
</div>
</div>
<script src="/test-assets/80f0bf/no-autoplay.js"></script>
</body>
```

#### Failed Example 5

This `video` element has an [instrument][] to pause, stop, or turn the audio volume off but the [instrument][] is not included in the accessibility tree.

```html
<head>
<style>
button {
color: #000;
}
button:hover {
cursor: pointer;
cursor: pointer;
background-color: grey;
color: white;
}
</style>
</head>
<body>
<div id="video-container">
<!-- Video -->
<video id="video" autoplay>
<source src="/test-assets/rabbit-video/video.mp4" type="video/mp4" />
<source src="/test-assets/rabbit-video/video.webm" type="video/webm" />
</video>
<!-- Video Controls -->
<div id="video-controls" aria-hidden="true">
<button type="button" id="play-pause" class="play">Play</button>
<button type="button" id="mute">Mute</button>
</div>
</div>
<script src="/test-assets/80f0bf/no-autoplay.js"></script>
</body>
```

### Inapplicable

Expand Down Expand Up @@ -186,6 +298,17 @@ This `audio` element does not play automatically.
<audio src="/test-assets/moon-audio/moon-speech.mp3" controls></audio>
```

#### Inapplicable Example 4

This `video` element does not play for longer than 3 seconds.

```html
<video autoplay>
<source src="/test-assets/rabbit-video/video.mp4#t=8,10" type="video/mp4" />
<source src="/test-assets/rabbit-video/video.webm#t=8,10" type="video/webm" />
</video>
```

[attribute value]: #attribute-value 'Definition of Attribute Value'
[instrument]: #instrument-to-achieve-an-objective 'Definition of Instrument to Achieve an Objective'
[media resource]: https://html.spec.whatwg.org/multipage/media.html#media-resource 'HTML Specification of Media Resource'
Expand Down
131 changes: 0 additions & 131 deletions _rules/auto-play-audio-does-not-exceed-3-seconds-aaa1bf.md

This file was deleted.

Loading