Skip to content

Instantly share code, notes, and snippets.

@babakfp
Last active April 15, 2025 14:43
Show Gist options
  • Save babakfp/ba36a8e8d4ddee5d32c1a8b6b14586f4 to your computer and use it in GitHub Desktop.
Save babakfp/ba36a8e8d4ddee5d32c1a8b6b14586f4 to your computer and use it in GitHub Desktop.
Get rid of Svelte A11Y errors in vsCode editor and console

Put it into your vsCode JSON config:

{
    "svelte.plugin.svelte.compilerWarnings": {
        "a11y-accesskey": "ignore",
        "a11y-aria-activedescendant-has-tabindex": "ignore",
        "a11y-aria-attributes": "ignore",
        "a11y-autofocus": "ignore",
        "a11y-click-events-have-key-events": "ignore",
        "a11y-distracting-elements": "ignore",
        "a11y-hidden": "ignore",
        "a11y-img-redundant-alt": "ignore",
        "a11y-incorrect-aria-attribute-type": "ignore",
        "a11y-invalid-attribute": "ignore",
        "a11y-interactive-supports-focus": "ignore",
        "a11y-label-has-associated-control": "ignore",
        "a11y-media-has-caption": "ignore",
        "a11y-misplaced-role": "ignore",
        "a11y-misplaced-scope": "ignore",
        "a11y-missing-attribute": "ignore",
        "a11y-missing-content": "ignore",
        "a11y-mouse-events-have-key-events": "ignore",
        "a11y-no-redundant-roles": "ignore",
        "a11y-no-interactive-element-to-noninteractive-role": "ignore",
        "a11y-no-noninteractive-tabindex": "ignore",
        "a11y-no-static-element-interactions": "ignore",
        "a11y-positive-tabindex": "ignore",
        "a11y-role-has-required-aria-props": "ignore",
        "a11y-role-supports-aria-props": "ignore",
        "a11y-structure": "ignore",
        "a11y-unknown-aria-attribute": "ignore",
        "a11y-unknown-role": "ignore",
        "avoid-mouse-events-on-document": "ignore",
        "a11y_accesskey": "ignore",
        "a11y_aria_activedescendant_has_tabindex": "ignore",
        "a11y_aria_attributes": "ignore",
        "a11y_autofocus": "ignore",
        "a11y_click_events_have_key_events": "ignore",
        "a11y_distracting_elements": "ignore",
        "a11y_hidden": "ignore",
        "a11y_img_redundant_alt": "ignore",
        "a11y_incorrect_aria_attribute_type": "ignore",
        "a11y_invalid_attribute": "ignore",
        "a11y_interactive_supports_focus": "ignore",
        "a11y_label_has_associated_control": "ignore",
        "a11y_media_has_caption": "ignore",
        "a11y_misplaced_role": "ignore",
        "a11y_misplaced_scope": "ignore",
        "a11y_missing_attribute": "ignore",
        "a11y_missing_content": "ignore",
        "a11y_mouse_events_have_key_events": "ignore",
        "a11y_no_redundant_roles": "ignore",
        "a11y_no_interactive_element_to_noninteractive_role": "ignore",
        "a11y_no_noninteractive_tabindex": "ignore",
        "a11y_no_static_element_interactions": "ignore",
        "a11y_positive_tabindex": "ignore",
        "a11y_role_has_required_aria_props": "ignore",
        "a11y_role_supports_aria_props": "ignore",
        "a11y_structure": "ignore",
        "a11y_unknown_aria_attribute": "ignore",
        "a11y_unknown_role": "ignore",
        "avoid_mouse_events_on_document": "ignore"
    },
}

in SvelteKit svelte.config.js file:

const config = {
    onwarn: (warning, handler) => {
        if (warning.code.startsWith("a11y")) return
        handler(warning)
    },
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment