dequelabs / axe-core

Accessibility engine for automated Web UI testing
https://www.deque.com/axe/
Mozilla Public License 2.0
5.75k stars 746 forks source link

aria-allowed-attr should incomplete attributes with a falsey value #4463

Open WilcoFiers opened 1 month ago

WilcoFiers commented 1 month ago

Had a question about this aria-multieline=false failing the aria-allowed-attr rule. This doesn't seem to impact screen reader use. Instead of raising this as an issue I think it would be better to report this as needing review. If at some point in the lifecycle of that component the state changes to true, there is a problem (since this information won't be available in the accessibility tree). But while this is false, failing this is inappropriate.

<!-- This incompletes / needs review -->
<div aria-multiline="false" tabindex="0" aria-labelledby="foo" role="combobox">

This fix should only apply to attributes that are allowed "false" as a value. The same probably holds for attributes with "undefined" as a valid value. That's rare though.

Update

Turns out the reason people sometimes do this is to avoid an issue where VoiceOver announces elements with contenteditable as multiline. Since a combobox cannot be multiline, this attribute is needed to ensure its announced as being a single line. So while I think the above example should incomplete, I think if this happens on an element with contenteditable axe-core should pass the rule:

<!-- This passes -->
<div aria-multiline="false" tabindex="0" aria-labelledby="foo" role="combobox" contenteditable>