Svelte a11y compiler warnings: deciding between build-time enforcement and suppressions
0 reputation · 10 Feb 2024, 02:56 UTC
0 reputation · 10 Feb 2024, 02:56 UTC
Svelte's compiler performs static accessibility analysis during compilation, emitting warnings for issues like missing alt attributes on images, invalid ARIA usage, and keyboard navigation gaps. These warnings appear in the build output without any external linting setup, and individual cases can be suppressed with svelte-ignore comments.
I'm designing a team workflow around these warnings and hitting a tension the documentation doesn't resolve. The compiler's analysis is static, so it cannot catch accessibility problems that emerge from dynamic state changes at runtime — for example, focus management after a conditional block renders, or live region behavior. That means the build-time warnings alone can't be the whole accessibility story.
At the same time, liberal use of svelte-ignore for edge cases (where the compiler can't know the runtime context) risks quietly eroding real coverage if suppressions are never revisited.
svelte-ignore suppressions so they don't accumulate unchecked?Assume a recent Svelte version; please note if behavior differs across major releases.
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.