diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts index 20381ee4f6..97b86c58d6 100644 --- a/src/compiler/compile/nodes/Element.ts +++ b/src/compiler/compile/nodes/Element.ts @@ -520,6 +520,12 @@ export default class Element extends Node { const has_missing_props = required_role_props.some(prop => !attributes.find(a => a.name === prop)); if (has_missing_props) { + // native checkbox/radio inputs do not require ARIA attributes + if (this.name === 'input') { + const type = attributes.find((a) => a.name === 'type').get_static_value(); + if (type === 'checkbox' || type === 'radio') return; + } + component.warn(attribute, compiler_warnings.a11y_role_has_required_aria_props(value as string, required_role_props)); } } diff --git a/test/validator/samples/a11y-role-has-required-aria-props/input.svelte b/test/validator/samples/a11y-role-has-required-aria-props/input.svelte index 8e88b08908..25cd241a05 100644 --- a/test/validator/samples/a11y-role-has-required-aria-props/input.svelte +++ b/test/validator/samples/a11y-role-has-required-aria-props/input.svelte @@ -7,3 +7,5 @@
+ + \ No newline at end of file