Fourth Rule of ARIA Use
states that we cant use role="presentation" nor aria-hidden="true" on focusable dom elements nor on dom elements that contain focusable dom elements
Thus for exemple, these are wrong : ...
<button aria-hidden="true">button</button>
<div role="presentation">
<button>button</button>
</div>
...while these are right :
<button aria-hidden="true" disabled>button</button>
<div role="presentation">
<button tabindex="-1">button</button>
</div>
So this could be something to warn about
If relevant 🙂
Can we imagine implementing this with a default error on "flat" focus elements,
and then overriding it for those disabled state exceptions ?
$selectors: "a, button, input, select, textarea";
$hidden-as-selectors: "[aria-hidden=true], [role='presentation']";
$hidden-as-state: "&[aria-hidden=true], &[role='presentation']";
$disablers: "&:disabled, &[tabindex='-1']";
@mixin ko() {
color: red;
}
@mixin ok() {
color: green;
}
// hidden focusable elements
#{$selectors} {
#{$hidden-as-state} {
@include ko;
#{$disablers} {
@include ok;
}
}
}
// focusable elements inside hidden elements
#{$hidden-as-selectors} {
#{$selectors} {
@include ko;
#{$disablers} {
@include ok;
}
}
}
Fourth Rule of ARIA Use
states that we cant use
role="presentation"noraria-hidden="true"on focusable dom elements nor on dom elements that contain focusable dom elementsThus for exemple, these are wrong : ...
...while these are right :
So this could be something to warn about
If relevant 🙂
Can we imagine implementing this with a default error on "flat" focus elements,
and then overriding it for those disabled state exceptions ?