Vize

a11y/role-has-required-aria-props

ARIA role が必要とする属性を指定します。

既定の重大度 プリセット 自動修正 オプション
warning happy-path, nuxt, ecosystem, opinionated なし なし

適用範囲:Vue SFC のテンプレートと各ブロック。ルールに必要な script の文脈も例に含めています。

悪い例

checkbox の role に、選択状態を示す aria-checked がありません。

<template>
  <span role="checkbox">Receive updates</span>
</template>

良い例

aria-checked="false" を追加し、checkbox に必要な状態を指定します。

<template>
  <span role="checkbox" aria-checked="false">Receive updates</span>
</template>

設定(Vite+)

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

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "a11y/role-has-required-aria-props": "warn"
    }
  },
});

設定したら vp run lint を実行します。

関連ページ