Skip to content
easeweb
Search topics

Autoplaying sound with no way to stop it

A brand film starts playing with its sound on as it scrolls into view, and the page has no control that pauses or mutes it.

WCAG 2.2
SC 1.4.2A
Required by
Section 508 · EN 301 549 (EU)
Broken if (entry.isIntersecting) film.play();
The accessibility problem illustrated: No vision:I can't hear my screen reader.
01

The problem

Screen reader users can't hear their screen reader over the soundtrack, so they can't find a way to stop it

02

Try it

Start the sound, then try to stop it with the keyboard

  • Broken 1: scroll down the shop’s page, or Tab through it, until its film comes into view. The film starts with its sound on. Go on with Tab, looking for a way to stop it, and watch the screen reader preview.

  • Broken 2: the shop starts its music on your first click anywhere on its page. Click it, then Tab through the page again.

  • Apply a fix. The film has its own buttons now: Tab to them and try them.

Broken Can you fix this?

No sound yet. The film further down the shop’s page starts with its sound on as it scrolls into view.

Ember Roasters

Fresh from our roastery

Roasted in small batches

Beans roasted every Monday and sent out the same week.

This week’s coffees

From farm to your cup

Shop the beans

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Let people choose when the sound starts

Before

A film that starts with its sound on as it scrolls into view

<section class="story">  <video id="film" src="our-story.mp4" poster="our-story.jpg"    loop playsinline></video>  <h2>From farm to your cup</h2></section><script>  const film = document.getElementById('film');  // Play the film, with its sound, once half of it is on screen.  const watch = new IntersectionObserver(([entry]) => {    if (entry.isIntersecting) film.play();  }, { threshold: 0.5 });  watch.observe(film);</script>
What is wrong3 points
  • The soundtrack starts by itself as soon as half the film is on screen, and keeps looping. The script calls play() with the sound on.
  • The browser doesn't hold it back. Browsers allow sound once the visitor has clicked, tapped or pressed a key anywhere on the site, which most have done by the time they scroll this far.
  • Nothing on the page stops it. With no controls and no other button, the only way to silence it is to leave the page or turn down the whole computer, screen reader included.
After

The film waits for Play

<section class="story">  <video id="film" src="our-story.mp4" poster="our-story.jpg"    loop playsinline aria-hidden="true"></video>  <h2>From farm to your cup</h2>  <button type="button" id="play" class="film-button">    <svg aria-hidden="true" focusable="false">      <use href="#icon-play"></use>    </svg>    <span class="visually-hidden">Play film</span>  </button></section><script>  const film = document.getElementById('film');  const play = document.getElementById('play');  // The icon and the hidden name change together.  const set = (button, icon, name) => {    button.querySelector('use').setAttribute('href', icon);    button.querySelector('.visually-hidden').textContent = name;  };  play.addEventListener('click', () => (film.paused ? film.play() : film.pause()));  const show = () => set(play, film.paused ? '#icon-play' : '#icon-pause',    film.paused ? 'Play film' : 'Pause film');  ['play', 'pause'].forEach((type) => film.addEventListener(type, show));</script>
How it is fixed4 steps
  1. Remove the script that starts the film. Nothing plays until someone presses Play, so scrolling past the film never sets it off, and the poster gives the section its picture until then.
  2. Add a Play film button. It is a real <button>, so it works from the keyboard, and once the film plays the same button pauses it.
  3. Hide the film itself with aria-hidden="true", and let the button say what it controls.
  4. Set the button's icon and hidden name from the film's real state, on play and pause, so they stay right even if playback fails.

This fixes both Befores and passes 1.4.2.

04

Verify the fix

5 checks, no mouse.

Test with: Keyboard, Screen reader, Autoplay settings

0 of 5 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the film or any embedded player changes.

Limits

This is a starting pattern, not a guarantee for every application. It covers sound: a muted video that loops by itself still needs a way to stop its movement, covered in background videos that loop with no pause button. Browsers change their autoplay rules, so a page that is silent today in one browser may not be tomorrow in another. Test the complete journey with your target browsers and assistive technology.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

EaseWeb service

Fixed it? Keep it from coming back.

I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.

See the service