Skip to content

MatSelect accessibility rework #11083

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

Closed
jelbourn opened this issue Apr 30, 2018 · 43 comments · Fixed by #20082
Closed

MatSelect accessibility rework #11083

jelbourn opened this issue Apr 30, 2018 · 43 comments · Fixed by #20082
Assignees
Labels
Accessibility This issue is related to accessibility (a11y) area: material/select feature This issue represents a new feature or feature request rather than a bug or bug fix P2 The issue is important to a large percentage of users, with a workaround

Comments

@jelbourn
Copy link
Member

This issue tracks rework of the MatSelect component to resolve multiple accessibility issues. Based on this prototype (just the a11y behavior and API, not the visuals)

Summary:

  • New template-based syntax for options driven by data instead of ngFor (the existing syntax will remain for backwards compatibility for at least two major versions)
  • Option text will always be in the DOM, but not the option templates
  • Interaction changes from listbox to combobox

This should capture issues reported in #5220, #10292, #6382, #3587, #1670

@jelbourn jelbourn added feature This issue represents a new feature or feature request rather than a bug or bug fix P2 The issue is important to a large percentage of users, with a workaround Accessibility This issue is related to accessibility (a11y) labels Apr 30, 2018
@jasonzhang2022
Copy link

jasonzhang2022 commented May 2, 2018

mat-paginator uses mat-select for the number of items of per page. So mat-paginator can't be used by VoiceOver, too.

@cec
Copy link

cec commented May 3, 2018

@jelbourn I hope I'm not wrong, but mat-select is used by mat-autocomplete as well right?

If so, will this rework would add the possibility for paginated autocomplete suggestions as discussed in #5046 ?

Thank you!

@jelbourn
Copy link
Member Author

jelbourn commented May 3, 2018

They're separate components but do share some code; that feature looks to be orthogonal to this.

@cec
Copy link

cec commented May 4, 2018

Hi @jelbourn , please pardon my ignorance, by orthogonal do you mean unrelated to this rework?

@jelbourn
Copy link
Member Author

jelbourn commented May 4, 2018

Yeah, I mean this rework doesn't affect that feature one way or another.

@JamieMcI
Copy link

Are there any known workarounds to this issue while waiting on the rework? I'm thinking of trying to style an HTML Select to look similar with a floating label, etc.

@jelbourn
Copy link
Member Author

Using a native select will certainly give better a11y.

@benelliott
Copy link
Contributor

@jelbourn Do you think there would be any value in moving the core and accessibility logic of MatSelect into a new CdkSelect component, so that MatSelect only provides the Material-specific styling on top of this? Creating a component that is functionally equivalent to native select is not at all trivial so it could be a very useful resource for people who want to make custom comboboxes without using Material Design.

@jelbourn
Copy link
Member Author

@benelliott It's something I'd like to do; we're still figuring out what we want the final API to look like. Once that's settled, we can figure out which parts make sense to be in the cdk.

@jasonzhang2022

This comment has been minimized.

@jrood
Copy link
Contributor

jrood commented Jun 14, 2018

@jelbourn If these discussions about the API need to remain internal, that's cool. Otherwise I'd be happy to contribute if you can point me to a particular thread.

@tinayuangao

This comment has been minimized.

@jrood

This comment has been minimized.

@kammokiran
Copy link

kammokiran commented Aug 6, 2018

Hi, I have an application where the mat-select has been used. It works fine with keyboard and the screen reader (jaws 17 and 18). I am able to select an option inside the select box. However once I come out of the select box, Jaws doesn't announce the selected value. Please could you suggest a solution for this issue.

@kammokiran
Copy link

kammokiran commented Aug 6, 2018

https://material.angular.io/components/select/overview

@zunaid2998

This comment has been minimized.

@412andrewmortimer
Copy link

For what it's worth:

I arrived here after our A11y scanner library threw this error in e2e.

Fail:  aXe - Certain ARIA roles must contain particular children

<mat-select OMITTED...>

    https://dequeuniversity.com/rules/axe/3.4/aria-required-children?application=webdriverjs

And let's just say hopping around these issues has been confusing. But simply putting role="listbox" on my <mat-select> and role="option" on my <mat-option> fixed my error.

<!-- Like this -->
<mat-select role="listbox">
  <mat-option role="option"></mat-option>
</mat-select>

Am I not understanding something about the bigger picture or how A11y works in general?

@leomendoza123

This comment has been minimized.

@Splaktar
Copy link
Contributor

@412andrewmortimer that might trick the scanner, but to verify if that helped or hurt (possible), you would need to test your app with screen readers like JAWS/NVDA (Windows), ChromeVox (ChromeOS), Talkback (Android), and VoiceOver (macOS/iOS).

@Splaktar
Copy link
Contributor

Some updates for my previous mdc-select mentions

  • In 4.0.0, material-components-web removed support for native select. The previously named "Enhanced" select is now the only option.
  • That same update broke a number of form-related use cases because it also removed the hidden input element. There is a PR ([MDCSelect] Add hidden input element to support HTML forms material-components/material-components-web#5428) to bring this back, but when it will be merged is unclear.
  • This 4.0.0 update is supposed to have improved the a11y and functionality of mdc-select, but I have not yet tested this in a screen reader.

There has been some thinking about the MDC-related mat-select in our material-experiemental package, but there is no implementation ready to try yet and no ETA is available. You can watch our material-experimental/mdc-select directory or the section after "Contributing" in the README for updated plans each quarter.

@dorival

This comment has been minimized.

@Splaktar

This comment has been minimized.

@mkslalom

This comment has been minimized.

@Splaktar
Copy link
Contributor

Hi is there any chance this bug will get fixed soon? :) Please and thank you.

Based on #11083 (comment), it's unlikely.

Is there a workaround?

Not at this time. The new MDC-based version of MatSelect should help with this, but it hasn't been implemented yet.

@Josee9988

This comment has been minimized.

@jelbourn jelbourn removed the has pr label May 27, 2020
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 26, 2020
Applies some of our recent learnings on how to handle the accessibility of a custom select to `mat-select`. Includes switching the trigger to be a `combobox` and the panel to a `listbox`.

Fixes angular#11083.
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 4, 2020
Applies some of our recent learnings on how to handle the accessibility of a custom select to `mat-select`. Includes switching the trigger to be a `combobox` and the panel to a `listbox`.

Fixes angular#11083.
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 5, 2020
Applies some of our recent learnings on how to handle the accessibility of a custom select to `mat-select`. Includes switching the trigger to be a `combobox` and the panel to a `listbox`.

Fixes angular#11083.
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 12, 2020
Applies some of our recent learnings on how to handle the accessibility of a custom select to `mat-select`. Includes switching the trigger to be a `combobox` and the panel to a `listbox`.

Fixes angular#11083.
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 20, 2020
Applies some of our recent learnings on how to handle the accessibility of a custom select to `mat-select`. Includes switching the trigger to be a `combobox` and the panel to a `listbox`.

Fixes angular#11083.
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 20, 2020
Applies some of our recent learnings on how to handle the accessibility of a custom select to `mat-select`. Includes switching the trigger to be a `combobox` and the panel to a `listbox`.

Fixes angular#11083.
andrewseguin pushed a commit that referenced this issue Aug 25, 2020
Applies some of our recent learnings on how to handle the accessibility of a custom select to `mat-select`. Includes switching the trigger to be a `combobox` and the panel to a `listbox`.

Fixes #11083.
annieyw pushed a commit to annieyw/components that referenced this issue Aug 31, 2020
Applies some of our recent learnings on how to handle the accessibility of a custom select to `mat-select`. Includes switching the trigger to be a `combobox` and the panel to a `listbox`.

Fixes angular#11083.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 25, 2020
wagnermaciel pushed a commit to wagnermaciel/components that referenced this issue Jan 14, 2021
Applies some of our recent learnings on how to handle the accessibility of a custom select to `mat-select`. Includes switching the trigger to be a `combobox` and the panel to a `listbox`.

Fixes angular#11083.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Accessibility This issue is related to accessibility (a11y) area: material/select feature This issue represents a new feature or feature request rather than a bug or bug fix P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.