Accessibility rules
ARIA, keyboard interaction, labels, landmarks and media alternatives, so templates work with assistive technology.
Each rule page shows a failing example, a passing example, and the configuration that turns the rule on.
Default (25)
Added by happy-path, the default preset.
| Rule | What it checks | Auto-fix |
|---|---|---|
a11y/alt-text |
Require alternative text for media elements. | |
a11y/anchor-has-content |
Require anchor elements to have accessible content. | |
a11y/anchor-is-valid |
Enforce valid href on anchor elements. | |
a11y/aria-props |
Disallow invalid ARIA attributes. | |
a11y/aria-role |
Elements with ARIA roles must use a valid, non-abstract ARIA role. | |
a11y/aria-unsupported-elements |
Disallow ARIA attributes on elements that do not support them. | |
a11y/click-events-have-key-events |
Require keyboard event handlers with click events. | |
a11y/form-control-has-label |
Require form controls to have associated labels. | |
a11y/heading-has-content |
Require heading elements to have accessible content. | |
a11y/iframe-has-title |
Require iframe elements to have a title attribute. | |
a11y/interactive-supports-focus |
Require interactive role elements to be focusable. | |
a11y/label-has-for |
Require labels to have associated form controls. | |
a11y/media-has-caption |
Require media elements to have captions. | |
a11y/mouse-events-have-key-events |
Require focus/blur events with mouse events. | |
a11y/no-access-key |
Disallow the use of the accesskey attribute. | |
a11y/no-aria-hidden-on-focusable |
Disallow aria-hidden="true" on focusable elements. | |
a11y/no-autofocus |
Disallow the use of the autofocus attribute. | |
a11y/no-distracting-elements |
Disallow distracting elements like <marquee> and <blink>. | |
a11y/no-i-for-icon |
Disallow using <i> element for icons. | |
a11y/no-redundant-roles |
Disallow redundant ARIA roles. | ✓ |
a11y/no-refer-to-non-existent-id |
Disallow references to non-existent IDs. | |
a11y/no-role-presentation-on-focusable |
Disallow role="presentation" or role="none" on focusable elements. | |
a11y/no-static-element-interactions |
Disallow event handlers on static elements. | |
a11y/role-has-required-aria-props |
Require ARIA roles to have required properties. | |
a11y/tabindex-no-positive |
Disallow positive tabindex values. |
Stricter presets (5)
Only in opinionated, nuxt or ecosystem. The Presets column lists which.
| Rule | What it checks | Presets | Auto-fix |
|---|---|---|---|
a11y/heading-levels |
Disallow skipping heading levels. | nuxt, opinionated |
|
a11y/landmark-roles |
Validate landmark role placement and uniqueness. | nuxt, opinionated |
|
a11y/placeholder-label-option |
Require a placeholder label option in a required select. | nuxt, opinionated |
|
a11y/use-list |
Suggest using list elements for bullet-like text. | nuxt, opinionated |
|
vue/use-unique-element-ids |
Enforce unique element IDs using useId() instead of static literals. | nuxt, opinionated |
Opt-in (1)
Not in any preset. Turn them on by name in the linter.rules passed to withVue.
| Rule | What it checks | Auto-fix |
|---|---|---|
a11y/img-alt |
Require alt attribute on images for accessibility. |