Accessibility
a11y/no-autoplay-audio
No audio plays automatically; autoplaying video is muted, and any sound longer than 3 seconds can be paused or stopped.
moderatestaticWCAG 1.4.2 · Afe-a11y-media
Why
Sound that starts on its own talks over a screen reader, so a blind user cannot hear the page well enough to find the control that stops it. Browsers also block most unmuted autoplay, so the feature is unreliable anyway.
Fix
Start media only when the person presses play. A decorative autoplaying video gets muted (and playsinline on iOS). If audio must start by itself, stop it within 3 seconds or put a pause or mute control first on the page.
Examples
<!-- bad -->
<video autoplay src="promo.mp4"></video>
<!-- good -->
<video autoplay muted loop playsinline src="promo.mp4"></video>
<video controls src="promo.mp4"></video>Sources
Facts
- Id
a11y/no-autoplay-audio- Severity
- moderate
- Check
- static checked in the source by
audit - Applies to
htmlangularvuesvelteastrojsx- WCAG 2.2
- 1.4.2, level A
- Same problem in
- axe-core
no-autoplay-audio - Taught by the skill
fe-a11y-mediaMedia, motion and flashing- Since version
- 0.1.0
Read it in the terminal
npx github:dawidolko/frontend-skills explain a11y/no-autoplay-audio