a11y/no-distracting-elements
Disallow distracting elements like <marquee> and <blink>.
| 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 marquee element introduces automatically moving text.
<template>
<marquee>Limited offer</marquee>
</template>
Good
A paragraph displays the same offer without the distracting marquee element.
<template>
<p>Limited offer</p>
</template>
Configuration (Vite+)
import { defineConfig } from "@vizejs/vite-plugin/vite-plus";
export default defineConfig({}).withVue({
linter: {
"preset": "incremental",
"rules": {
"a11y/no-distracting-elements": "warn"
}
},
});
Then run vp run lint.