Skip to content

Several accessibilty issues in DropdownList #174

@rgommezz

Description

@rgommezz

We found your Dropdown component perfect for our needs in a large scale project we are building.
However, we have to be compliant with accessibility and came across several accessibility issues, since we are trying to support JAWS screen readers and keyboard navigation, so I believe it would be great to address it so that the component could have a much wider audience, and consequently, be more awesome (as it's already):
-Keyboard navigation works as described, as long as tabIndex="0" it's specified, to make the dropdown focusable when you navigate with the keyboard.
JAWS, however, is not able to read each of the elements contained in the dropdown, as soon as you select one with the keyboard.
Here a list of the initial accessibility violations our tool triggered, and I will try to point out the facts causing them.

Potencial violation, Use header elements where appropriate
-Refering to the div parent
Violation, The WAI-ARIA property aria-expanded is not supported global property on element DIV that does not have a WAI-ARIA role
-This is clearly a listbox role, but we are talking about the parent element, <div>, and the listbox role makes sense to be applied in the <ul role="listbox"> element (3 inner levels), with <li role="option"> its corresponding items, as it's already done. So not sure which role makes sense to be applied to the div parent.
I tried <div role="group" aria-label="this is a dropdown"/> and that solves the violation, keeping only the "header" potencial violation. However, when I select another element in the dropdown, close it, and run the tool again, 3 new violations come into place pointing to the inner elements, specifically:
Violation, ID values must be unique.
-That refers to the <li id=""> elements, whose IDs are all the same, an empty string
Violation, a WAI-ARIA widget must have an accessible name
-<ul> elements and <li> elements have a role specified, listbox and option respectively. However they should also define an accessible name specified with aria-label or aria-labelledby , as long as a role is specified.
Potencial Violation, The ul element with WAI-ARIA role listbox might not be keyboard accessible. See rule help for remediation guidance
-That's a false positive, the dropdown is fully acessible by keyboard
Potencial Violation, Use header elements where appropriate
-The same as the initial one referred to the parent <div>

In terms of JAWS screen readers, and based on the violation a WAI-ARIA widget must have an accessible name, I believe specifying an aria-label attribute in the <li> elements, along with the role, will make JAWS read it, something like dinamically binding that attribute to the <li> text content, i.e. <li id="randomID" role="option aria-label="item1">item1\</li>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions