a11y/no-role-presentation-on-focusable
フォーカス可能な要素の意味を presentation で消した指定を検出します。
既定の重大度: error
プリセット: happy-path, nuxt, ecosystem, opinionated
自動修正: なし。修正内容を確認してください
適用範囲: Vue SFC のテンプレート・ブロック。必要な script の文脈も例に含めています。
オプション: ルール固有のオプションはありません。重大度とプリセットは設定できます。
設定(Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({
lint: {
vize: {
"preset": "incremental",
"rules": {
"a11y/no-role-presentation-on-focusable": "error"
}
},
},
});
vp run lint
悪い
focus できる Billing のリンクに role=presentation を指定し、操作可能なリンクの役割と矛盾させています。ブラウザはこの presentation の指定を無視する必要があります。
<template>
<a href="/billing" role="presentation">Billing</a>
</template>
良い
矛盾する presentation の指定を除き、Billing への標準のリンクの役割を使います。
<template>
<a href="/billing">Billing</a>
</template>
良い例は上記の設定でこのルールの検出を避ける例です。他のルールでは検出される場合があります。