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.
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
- Read the rule name and location in the warning.
- Add the missing
alt, label, or role the rule asks for. - Re-run the check to confirm the warning is gone.
<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.
<!-- svelte-ignore a11y-missing-attribute -->
<img src={decorative} />How to prevent it
- Address a11y warnings as they appear rather than batching them.
- Use
svelte-ignoreper line for reviewed exceptions, not a blanket disable. - Keep the zero-warning gate so accessibility does not regress.