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.
if (entry.isIntersecting) film.play(); The problem
Screen reader users can't hear their screen reader over the soundtrack, so they can't find a way to stop it
A coffee roaster's home page tells the story of its beans in a short brand film, halfway down the page under the week's coffees: roasted beans tumbling onto a pile, to music. When half the film is on screen, a script starts it, with its sound on, and it loops. The film has no controls, and nothing else on the page pauses or mutes it. Browsers would hold that sound back on a page nobody had touched, but by the time anyone scrolls this far, most have clicked something: the cookie banner, the menu, a coffee. A screen reader user pressing Tab down the page reaches the link over the film, the page scrolls to show it, and the music starts on top of their screen reader. They press Tab on, looking for a way to stop it: every link is half drowned out, and none of them is a pause button. Other sites play their music without a film: a background track that a script starts on the visitor's first click anywhere on the page, whether that click opened the menu or chose a product.
Success criterion 1.4.2 allows sound to start by itself only if it stops within three seconds, or if the page gives a way to pause or stop it, or to turn its volume down apart from the system volume. Here the film has no controls and no button of its own, and the script that plays it never mutes it, so once it has scrolled into view the soundtrack plays for as long as the page is open. Browsers let it: what they check before allowing sound is whether the visitor has clicked, tapped or pressed a key on the site, not whether they asked for sound. The background track fails the same way: it starts without being asked for, because the click that started it was for something else, and nothing on the page stops it.
The film starts as it is scrolled to, so it surprises people who only meant to read on. It also catches out anyone in a quiet office, a library or on a train, who often closes the tab rather than look for the source.
3 of 10 groups affected
- No vision (affected)
- Low vision (not affected)
- Colour vision (not affected)
- No hearing (not affected)
- Hard of hearing (affected)
- No speech (not affected)
- Motor (not affected)
- Reach, strength (not affected)
- Cognitive (affected)
- Seizures (not affected)
- Without vision The soundtrack plays over the screen reader's speech, so people can't hear the page, or the control that would stop it. Turning the computer's volume down silences the screen reader too.
- Limited hearing With some hearing, a second sound under the screen reader or a voice makes both hard to follow, and hearing aids raise the soundtrack along with everything else.
- Limited language, cognitive and learning abilities Sound that starts by itself pulls attention away from the page, and people who are easily distracted or overwhelmed by sound can't settle to read until it stops.
Nothing plays until the film is on screen, and browsers hold its sound back until the visitor has clicked, tapped or pressed a key on the site. A tester who pastes the address into a fresh browser and looks at the top of the page hears nothing, and neither does a headless audit that loads the page without clicking or scrolling. Visitors do both. axe flags autoplay without muted or controls, but only for a person to confirm, and this film has no autoplay attribute for it to find: a script starts it with play(). A check that records a script's play() calls sees this one only on a page that has been scrolled to the film. AI fixes may add muted and leave out any pause button, which silences the film but leaves a looping video that nobody can pause.
What the checkers report
- axe DevTools
- <video> or <audio> elements must not play automatically
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.
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 beansThe fix
Let people choose when the sound starts
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.
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
- 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.
- 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. - Hide the film itself with
aria-hidden="true", and let the button say what it controls. - Set the button's icon and hidden name from the film's real state, on
playandpause, so they stay right even if playback fails.
This fixes both Befores and passes 1.4.2.
Why this fix: Change the page only when people ask
Both pass 1.4.2. Waiting for Play costs nothing and is quiet for everyone: choose it when the film's point is what it says, or when the page looks finished with the film still. Starting muted keeps the moving picture the design was built around, and costs only the sound until someone asks for it: choose it when the film should move as soon as it is seen.
Films set into a page as a section rarely show the browser's control bar, so the snippets give the film round icon buttons of its own. They are real <button> elements, so they need no ARIA role, and an icon alone is fine on screen as long as each of these holds.
- The name is in the code: hidden text such as "Pause film", or an
aria-label, with the icon markedaria-hidden="true". Hidden text is translated by browser translation tools, which do not always translatearia-label. - The icon has 3:1 contrast against what is behind it (1.4.11). Over moving footage that means a solid dark disc under a white icon, which is what
.film-buttonstands for here, alongside the usual.visually-hiddenclass. - The button is at least 24 by 24 pixels (2.5.8); 44 is the usual size for a control floating over a film.
- The focus ring shows against the film.
- The icon and the name change together: the pause icon with "Pause film", the play icon with "Play film".
Play, pause and speaker icons are familiar enough to stand alone. A tooltip on hover and focus is optional, and if you add one it has to meet 1.4.13 (Content on Hover or Focus). A button that changes its name when pressed is not announced again by every screen reader, so check it with the ones your users have.
Native controls pass too, and are the better choice for a film people sit and watch, such as a product video; they also bring a captions menu, which buttons of your own have to provide when the film has speech.
A brand film that only sets the mood needs nothing read about what it shows, so the snippets hide it with aria-hidden="true" and let the buttons say what they control. That works only while the film has no controls of its own: on a <video controls> it would hide focusable buttons, so give such a film a short name instead, such as aria-label="Brand film". Either way, hiding a film from screen readers does nothing to its sound. Screen readers announce nothing when media starts, so the music simply plays over their speech.
Pausing the film again when it scrolls out of view, as some of these scripts also do, is not a fix either. The sound still plays for as long as the film is on screen, and the visitor reading the links beside it still has nothing to stop it with.
A third way passes 1.4.2 on paper, but is not a fix to plan around: let the sound start by itself, with a "Turn sound off" button first on the page (technique G170). It falls short in three ways.
- Browsers block the very sound it protects on a first visit, so the design rarely plays as intended.
- Screen reader users still have to find the button while the music talks over their screen reader.
- It passes only while the button stays first, so a cookie banner or skip link added later quietly breaks it.
If a page really must start sound by itself, keep that button first, and in words rather than a lone icon.
A sound that ends within three seconds needs no control, which is why a short chime is fine. That is no way out for a long soundtrack: cutting it to three seconds changes the content more than adding a Play button does.
A volume slider inside the page counts as a control too, provided it changes only this page's sound. The system volume never counts, because it also controls the screen reader.
Sound that starts by itself does not only come from a film that a script plays as it scrolls into view. Each of these plays automatically in the sense of 1.4.2, and each takes the same fixes.
- A
videooraudiotag withautoplayand nomuted: browsers often hold its sound back, but not in every case. - Background music players, common on brand and restaurant sites: start them off, with a labelled button to turn them on.
- Embedded players from YouTube or Vimeo with autoplay switched on in their address: also switch on their mute option, and leave their controls showing.
- Scripts that call
play()on the visitor's first click anywhere on the page: that click opened a menu or followed a link, so it was not a request for sound.
Some frameworks set muted as a property after the page loads instead of writing the attribute. Check the served HTML for the attribute, and check in the browser that the film is silent from the first frame.
Whichever fix you choose, a film with speech needs captions that a person has checked, and with buttons of your own, a way to turn them on. This film has only music, so its snippets leave captions out.
Verify the fix
5 checks, no mouse.
Test with: Keyboard, Screen reader, Autoplay settings
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.