Skip to content
Latchkey

Svelte A11y warnings treated as errors in CI

The Svelte compiler emits accessibility warnings such as "A11y: <img> element should have an alt attribute". They are warnings by default, but a CI gate that fails on any warning turns them into build failures.

What this error means

A svelte-check or build step lists "A11y:" warnings and the job fails, because --fail-on-warnings or a zero-warning threshold treats them as errors.

svelte-check
Warn: A11y: <img> element should have an alt attribute (src/routes/+page.svelte:14:4)
====================================
svelte-check found 0 errors and 1 warning
Error: Process completed with exit code 1.

Common causes

Real accessibility issues in markup

Missing alt, a label-less form control, or a click handler on a non-interactive element triggers a specific a11y warning the compiler can detect.

A zero-warning gate in CI

The job runs svelte-check --fail-on-warnings or a threshold of 0, so any a11y warning fails the build.

How to fix it

Fix the accessibility issue

  1. Read the rule name and location in the warning.
  2. Add the missing alt, label, or role the rule asks for.
  3. Re-run the check to confirm the warning is gone.
Component.svelte
<img src={logo} alt="Company logo" />

Suppress a specific, reviewed warning

When a warning is a deliberate false positive, silence that one line with a directive rather than disabling the whole gate.

Component.svelte
<!-- svelte-ignore a11y-missing-attribute -->
<img src={decorative} />

How to prevent it

  • Address a11y warnings as they appear rather than batching them.
  • Use svelte-ignore per line for reviewed exceptions, not a blanket disable.
  • Keep the zero-warning gate so accessibility does not regress.

Frequently asked questions

What causes "Svelte "A11y:" warnings fail CI"?
Missing alt, a label-less form control, or a click handler on a non-interactive element triggers a specific a11y warning the compiler can detect.
How do I fix Svelte "A11y:" warnings fail CI?
Fix the accessibility issue

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card