File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
src/compiler/compile/nodes
test/validator/samples/a11y-role-has-required-aria-props Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -520,6 +520,12 @@ export default class Element extends Node {
520
520
const has_missing_props = required_role_props . some ( prop => ! attributes . find ( a => a . name === prop ) ) ;
521
521
522
522
if ( has_missing_props ) {
523
+ // native checkbox/radio inputs do not require ARIA attributes
524
+ if ( this . name === 'input' ) {
525
+ const type = attributes . find ( ( a ) => a . name === 'type' ) . get_static_value ( ) ;
526
+ if ( type === 'checkbox' || type === 'radio' ) return ;
527
+ }
528
+
523
529
component . warn ( attribute , compiler_warnings . a11y_role_has_required_aria_props ( value as string , required_role_props ) ) ;
524
530
}
525
531
}
Original file line number Diff line number Diff line change 7
7
<span role =" checkbox" aria-checked =" false" ></span >
8
8
<div role =" meter" aria-valuenow =" 50" aria-valuemin =" 0" aria-valuemax =" 100" ></div >
9
9
<div role =" scrollbar" aria-controls =" panel" aria-valuenow =" 50" ></div >
10
+ <input role =" switch" type =" checkbox" />
11
+ <input role =" switch" type =" radio" />
You can’t perform that action at this time.
0 commit comments