Vize

a11y/tabindex-no-positive

通常のフォーカス順序を変える正の tabindex を検出します。

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

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

悪い例

tabindex に正の値 3 を指定し、通常の操作要素より先にフォーカスが移動するようにしています。

<template>
  <button tabindex="3">Save</button>
</template>

良い例

正の tabindex を取り除き、button の標準のフォーカス順を使います。

<template>
  <button>Save</button>
</template>

設定(Vite+)

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

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

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

関連ページ