afcapel / stimulus-autocomplete

Stimulus autocomplete component
MIT License
478 stars 61 forks source link

Prevent Lighthouse Aria warnings #117

Closed klemens-u closed 2 years ago

klemens-u commented 2 years ago

A widget with stimulus-autocomplete triggers a warning in Google Chrome devtools "Lighthouse" accessibility section:

[aria-*] attributes do not match their roles
Each ARIA `role` supports a specific subset of `aria-*` attributes. Mismatching these invalidates the `aria-*` attributes. 

Solution: add `role="combobox" to the parent element. Example:

<div  data-controller="autocomplete"
         data-autocomplete-url-value="/foo"
         role="combobox"
    >
    ...
</div>

Please check if this should be added to the code or to the documentation. Thank you!

afcapel commented 2 years ago

Thanks for the suggestion, fixed in https://github.com/afcapel/stimulus-autocomplete/pull/118.