[fix] omit a11y warning for native checkbox/radio inputs

Fixes #7837
pull/7838/head
Eric Liu 4 years ago committed by tanhauhau
parent d7cfe22f37
commit b23e6ce859

@ -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));
}
}

@ -7,3 +7,5 @@
<span role="checkbox" aria-checked="false"></span>
<div role="meter" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
<div role="scrollbar" aria-controls="panel" aria-valuenow="50"></div>
<input role="switch" type="checkbox" />
<input role="switch" type="radio" />
Loading…
Cancel
Save