hypra

A11Y-003: video has no captions

Error: the page doesn't build until this is fixed.

Captions are how deaf and hard-of-hearing people follow a video, and how everyone else watches it with the sound off, on a train or in an office. captions adds the captions file as a <track>. (WCAG 1.2.2)

Fails

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  video("/videos/runner-x.mp4")
}
error[A11Y-003]: video has no captions
 --> page.hypra:3:3
  |
3 |   video("/videos/runner-x.mp4")
  |   ^^^^^
  = help: add captions: "/clip.vtt"; a video without sound takes muted: true instead
  = docs: https://hypralang.dev/rules/a11y-003/

1 error, 0 warnings

Fixed

page(title: "Shoes", description: "All our running shoes, from light racers to trail shoes.") {
  h1 "Shoes"
  video("/videos/runner-x.mp4", captions: "/videos/runner-x.vtt")
  video("/videos/sole-closeup.mp4", muted: true)
}

A video without sound has nothing to caption: mark it muted: true instead.