a11y/aria-unsupported-elements
Disallow ARIA attributes on elements that do not support them.
| Default severity | Presets | Automatic fix | Options |
|---|---|---|---|
error |
happy-path, nuxt, ecosystem, opinionated |
No | None |
Applies to: Vue SFC templates and blocks, with script context where the rule requires it.
Bad
The metadata element carries aria-hidden, although meta does not support ARIA attributes.
<template>
<meta charset="utf-8" aria-hidden="true" />
</template>
Good
Removing the ARIA attribute leaves the charset declaration intact.
<template>
<meta charset="utf-8" />
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"a11y/aria-unsupported-elements": "error"
}
},
});
Then run vp run lint.