Vize

a11y/landmark-roles

ランドマーク role の配置と重複を検査します。

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

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

悪い例

同じテンプレートに main が二つあり、主要な領域が重複しています。

<template>
  <main>Dashboard</main>
  <main>Settings</main>
</template>

良い例

Dashboard を main として残し、Settings を名前付きの nav に変更します。

<template>
  <main>Dashboard</main>
  <nav aria-label="Settings">...</nav>
</template>

設定(Vite+)

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

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

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

関連ページ