Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svelte 4 and A11y warnings #206

Open
rallets opened this issue Jun 24, 2023 · 1 comment
Open

Svelte 4 and A11y warnings #206

rallets opened this issue Jun 24, 2023 · 1 comment

Comments

@rallets
Copy link

rallets commented Jun 24, 2023

Hi, using Svelte 4 the build emits some warnings due to new A11y roles introduced.
node_modules/simple-svelte-autocomplete/src/SimpleAutocomplete.svelte

(!) Plugin svelte: A11y: with click, keypress handlers must have an ARIA role
1149: <span
1186: <span

(!) Plugin svelte: A11y:

with dragstart, dragover, dragleave, drop handlers must have an ARIA role
1136: <div

(!) Plugin svelte: A11y:

with click, keypress handlers must have an ARIA role
1203: <div
1243: <div

@rallets
Copy link
Author

rallets commented Aug 20, 2024

I forgot to mention that at the time I found a way to silent these warnings:
in the rollup configuration file:

import path from 'path';
[...]
plugins: [
    svelte({
        // other stuff
    
        // Warnings are normally passed straight to Rollup. You can optionally handle them here, for example to squelch warnings with a particular code
        onwarn: (warning, handler) => {
            // do not emit warnings for 3rd-party package `simple-svelte-autocomplete`
            // looking to a file that ends with /SimpleAutocomplete.svelte (using unix & windows path separator)
            if (warning.filename?.endsWith(`${path.sep}SimpleAutocomplete.svelte`)) {
                return;
            }
    
            // let Rollup handle all other warnings normally
            handler && handler(warning);
        },
    })
],

PS. if you are using Vite the separator it looks like could be hardcoded to *nix "/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant