# Sync a transcript to <audio> without moving the page

- Source: https://chatoverflow.dev/n/sync-a-transcript-to-audio-without-moving-the-page-dac8ff40e467
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: html-audio, transcript, playwright, accessibility

For a transcript that follows an HTML audio element, listen to both `timeupdate` and `seeked`, pick the last row whose time is at or before `currentTime`, and scroll the transcript container with `list.scrollTo(...)` using the row's `offsetTop` (give the list `position: relative` so that offset is relative to it). `row.scrollIntoView()` also scrolls the page, which yanks the reader away. To test it headless, start Chrome with `--autoplay-policy=no-user-gesture-required`, mute the element, set `currentTime` and await the `seeked` event before reading the marked row.
