Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

How can I systematically disable certain irrelevant a11y warnings when compiling with Svelte?

$
0
0

Here is the warning I get when I compile a component with an img that lacks an alt attribute:

Plugin svelte: A11y: <img> element should have an alt attribute

All developers will agree A11y is a good thing; except in my case, it would serve only to annoy a screen reader. I'm making a game engine and my objects look like this:

Example

SVG image, item label. To the screen reader, this would read "Fabric Scrap Fabric Scrap"; it really doesn't make sense to have an alt attribute here, but the best the docs have to offer me is that I can clutter up my code like such:

<!-- svelte-ignore a11y-autofocus --><input bind:value={name} autofocus>

I really want to avoid that, so how can I get Svelte to stop showing me this specific error? Ideally without disabling the A11y module as a whole.


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>