dequelabs / axe-core

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

autocomplete-valid with multiple values fails #4581

Open emmasax opened 5 days ago

emmasax commented 5 days ago

Product

axe-core

Product Version

4.10.0

Latest Version

Issue Description

Expectation

Setting the value of autocomplete with a space separated list should pass the tests

Actual

Only a single value passes

How to Reproduce

Fail

<label for="searchTextInput">Enter postcode, town or city*</label>
<input autocomplete="street-address postal-code" id="searchTextInput" aria-required="true" aria-label="Enter postcode, town or city" minlength="2"  type="text" value="" name="searchValue" />

Pass

<label for="searchTextInput">Enter postcode, town or city*</label>
<input autocomplete="postal-code" id="searchTextInput" aria-required="true" aria-label="Enter postcode, town or city" minlength="2" type="text" value="" name="searchValue" />

Pass

<label for="searchTextInput">Enter postcode, town or city*</label>
<input autocomplete="street-address" id="searchTextInput" aria-required="true" aria-label="Enter postcode, town or city" minlength="2" type="text" value="" name="searchValue" />

Additional context

WilcoFiers commented 1 day ago

@emmasax Using values like this isn't valid HTML. Since it sounds like this isn't necessarily about user data it would be better to remove autocomplete from the field.

The accessibility issue here seems minor. This rule tests a WCAG criterion which was intended to allow people to add custom styles, such as adding an icon to certain fields to allow people to more easily understand their purpose. Giving the field multiple values like this can result in multiple such styles being applied.

As far as I'm aware assistive technologies like this aren't widely available / used, so this is more a potential future problem than a real problem today. Still you're probably best removing the autocomplete attribute from that field.