Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A11y: chosen-single link should have role="button" #52

Open
juanolalla opened this issue Sep 25, 2023 · 2 comments
Open

A11y: chosen-single link should have role="button" #52

juanolalla opened this issue Sep 25, 2023 · 2 comments

Comments

@juanolalla
Copy link

Accessibility alerts about the following error: Anchor element found with link content, but no href, ID or name attribute has been supplied.

Steps to reproduce

Just configure chosen and inspect the code around the drop-down item. Everything is wrapped in the "chosen-single" class link with no href, id or name.

Expected behavior

The link <a class="chosen-single"> should be a button if it is an action. Converting it into a button would have a great impact on the library, so I suggest just to add role="button" as attribute to this link.

@juanolalla
Copy link
Author

Fixed in pull request: #53

@juanolalla
Copy link
Author

Added a commit to complete the implementation. Now it also adds an aria-label to inform screen readers what will happen if you click the button, "Show options" or "Hide options". It hides the visual arrow up/down indicator container from screen readers with aria-hidden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant