Vize

a11y/media-has-caption

Require media elements to have captions.

Default severity Presets Automatic fix Options
warning happy-path, nuxt, ecosystem, opinionated No None

Applies to: Vue SFC templates and blocks, with script context where the rule requires it.

Bad

The video has playback controls but no caption track.

<template>
  <video src="/demo.mp4" controls />
</template>

Good

A track with kind="captions" supplies the English captions for the same video.

<template>
  <video src="/demo.mp4" controls>
    <track kind="captions" src="/demo.en.vtt" srclang="en" label="English" />
  </video>
</template>

Configuration (Vite+)

import { defineConfig } from "@vizejs/vite-plugin/vite-plus";

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "a11y/media-has-caption": "warn"
    }
  },
});

Then run vp run lint.