a11y/role-has-required-aria-props
Require ARIA roles to have required properties.
| 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 checkbox role omits aria-checked, which conveys the checkbox state.
<template>
<span role="checkbox">Receive updates</span>
</template>
Good
aria-checked="false" supplies the state required by the checkbox role.
<template>
<span role="checkbox" aria-checked="false">Receive updates</span>
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"a11y/role-has-required-aria-props": "warn"
}
},
});
Then run vp run lint.