A11yTranscript / 1.0

The media moves. The words stay.

A11yTranscript starts with an ordinary HTML transcript, then adds cue highlighting and seeking when JavaScript is available. Try the basics here, or open a focused demo to compare settings, work with a longer transcript, and see how setup errors are handled.

What to expect

  • The media is bundled with the demo, so no third-party service is needed.
  • Auto-scroll stays off until you enable it, and pauses after user interaction.
  • Choosing a cue gives a polite status update with the new playback time.
  • Turn off JavaScript and every transcript still reads normally.

Start with plain HTML

A useful transcript does not need media or JavaScript. Clear, semantic HTML is enough.

Transcript — Building accessible interfaces

Host: If you are building a transcript, where do you start?

Guest: With clear content and the right native HTML for its structure.

Host: And if JavaScript fails or never loads?

Guest: Nothing important disappears. The complete transcript is still there to read and copy.

Add sync to audio

Press play to follow the current cue, or choose any cue to jump to that point. The current cue gets aria-current="time", and focus stays on the cue you chose.

Transcript — Local narration

Use the same setup with video

The transcript can connect to a native <video> in the same way. This example uses the same narration but groups it into four longer cues.

Transcript — Video version

Build your own synced transcript

Start with native media controls and a complete HTML transcript. Add timestamps to the cue buttons, connect the transcript to the media, and initialize it once. If JavaScript does not load, the transcript is still available.

HTML

<audio id="episode-audio" controls>
  <source src="/media/episode.m4a" type="audio/mp4" />
</audio>

<section
  class="a11y-transcript"
  data-a11y-transcript
  data-media="#episode-audio"
  data-sync
  aria-labelledby="episode-transcript-title"
>
  <!-- data-media connects this transcript to the native audio element. -->
  <h2 id="episode-transcript-title" class="a11y-transcript__title">
    Episode transcript
  </h2>
  <ol class="a11y-transcript__list">
    <li class="a11y-transcript__item">
      <button class="a11y-transcript__cue" type="button" data-start="0" data-end="8">
        <span class="a11y-transcript__time">00:00</span>
        Welcome to the episode.
      </button>
    </li>
  </ol>
</section>

JavaScript

import { createA11yTranscript } from "a11y-transcript";
import "a11y-transcript/styles.css";

const root = document.querySelector("[data-a11y-transcript]");

if (root instanceof HTMLElement) {
  // The source HTML remains useful when JavaScript is unavailable.
  createA11yTranscript(root);
}

Try the other demos

Things worth testing

  • Reload with JavaScript disabled. Every transcript should still be readable.
  • Use Enter and Space on a cue. Playback should seek without moving focus.
  • Inspect the current cue during playback. It should have aria-current="time".
  • Listen with a screen reader. Automatic cue changes should not be announced.
  • Test at 200% zoom, 320 CSS pixels, and in forced-colors mode.