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

Accessibility on Select #606

Open
dmlayton opened this issue Jun 17, 2023 · 0 comments
Open

Accessibility on Select #606

dmlayton opened this issue Jun 17, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@dmlayton
Copy link

Using the Select component gives a few accessibility warnings. Vanilla it saya the aria-* atributes don't match the role on the select anchor. Since the select anchor is a div and not role is set, but aria-required is for a required field, it give this warning

To Reproduce
Steps to reproduce the behavior:

  1. Run lighthouse on https://sveltematerialui.com/demo/select/
  2. Scroll down to 'Requires'
  3. See error

You can get rid of the error by setting the role on the anchor to combobox with <Select anchor$role="combobox" required>, but then you have an issue that aria-expanded is not set initially (it's required). Additionally, it's not labelled so I added

    aria-expanded="false"
    aria-labelledby={inputId + '-smui-label'}    // <-- maybe this should be a variable for DRY

to the div that is the anchor and patched.

Now lighthouse is happy, and I'm fairly certain combo box it the correct semantics

@dmlayton dmlayton added the bug Something isn't working label Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant