-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(option): Remove aria-selected='false' in single-selection mode #15617
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
fix(option): Remove aria-selected='false' in single-selection mode #15617
Conversation
Worth adding that aria-selected=false has some precedent for being used in multiple select cases https://www.w3.org/TR/2017/WD-wai-aria-practices-1.1-20170628/examples/listbox/listbox.html. If Angular Material team agrees, I'd suggest omitting aria-selected=false on single select and include it on multiple. This only affects MatSelect; the same change would need to be done in other components that use MatOption directly. |
Agreed with @stevenyxu that we should omit the Also cc @jelbourn |
a3a4b8e
to
7b5b0b5
Compare
I also agree that we should just do this by default based on the single selection vs. multi-selection distinction. That would avoid adding the new API surface to the component. |
Making sure MatSelect and MatAutocomplete work as expected as part of this change seems sensible, and I think everyone has agreed on the single vs. multiple differentiation. As for opening a new input on MatOption, it's not clear to me there's a way around this. MatOption maintains its own selected state and for it to bind its own aria-selected attribute is more coherent than e.g., exposing an API to set the attribute to MatSelect/MatAutcomplete. Is there an alternative that allows MatOption to omit aria-selected=false in single MatSelect case and have it in multiple MatSelect without adding to the API? The only potential suggestion I had, though I don't feel strongly, is to make it a positive or enum API rather than a negative one like "disableAriaSelectedExplicitFalse", so more like
I considered suggesting an internal API, but there is a preference to make it public since our use case involves MatOption on its own, without MatSelect. |
The |
Thanks for the suggestions, everyone! I'll investigate if having our component implement |
bdf18a2
to
1e20ed2
Compare
Using the single vs. multiple info provided in the |
1e20ed2
to
0807dce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a few small comments
…tion mode Along the same lines as angular#15617 since the setup between `mat-select` and `mat-chip-list` fairly similar. Removes the `aria-selected` from deselected chips in single selection mode in order to reduce the amount of noise for screen reader users.
…tion mode Along the same lines as angular#15617 since the setup between `mat-select` and `mat-chip-list` fairly similar. Removes the `aria-selected` from deselected chips in single selection mode in order to reduce the amount of noise for screen reader users.
0807dce
to
f0eb6b1
Compare
Remove the aria-selected attribute from unselected options in single selection mode. The multi-selection behavior is unchanged. Motivation: the screen reader NVDA announces 'not selected' on any element that has aria-selected='false', which is disruptive when a user is navigating through a long list of options. The W3 aria best practices example only uses aria-selected='true for single selection', false is implicit: https://www.w3.org/TR/wai-aria-practices/examples/listbox/listbox-collapsible.html
f0eb6b1
to
0d666a5
Compare
Just commenting to note that I made the requested changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…15617) Add an Input to optionally remove the aria-selected attribute from unselected options. The default behavior is unchanged. Motivation: the screen reader NVDA announces 'not selected' on any element that has aria-selected='false', which is disruptive when a user is navigating through a long list of options. The W3 aria best practices example only uses aria-selected='true', false is implicit: https://www.w3.org/TR/wai-aria-practices/examples/listbox/listbox-collapsible.html
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Add an Input to optionally remove the aria-selected attribute from unselected options.
The default behavior is unchanged. Motivation: the screen reader NVDA announces 'not selected'
on any element that has aria-selected='false', which is disruptive when a user is navigating
through a long list of options. The W3 aria best practices example only uses aria-selected='true',
false is implicit:
https://www.w3.org/TR/wai-aria-practices/examples/listbox/listbox-collapsible.html