fix(MultiSelect): adds and updates list item aria, fixes type bug w/ itemToString #7889
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #6840
The selected state of a MultiSelect option wasn't being read since
aria-selected
wasn't being appropriately applied (due to us not using Downshift'suseMultipleSelection
hook). Thea11y-status-message
was readingselectedItem
as "undefined" due to a type error passing an object of multiple selected items toitemToString()
.Changelog
New
aria-label
for better cross browser/cross reader support and so we don't have to rely on Downshift's a11y-status-messagediv
Changed
itemToString
to loop through multiple selectionsgetItemProps
that checks and apply'saria-selected
correctly for multiple items*Testing / Reviewing
Using a screen reader (NVDA, VoiceOver, or JAWS) confirm that the SELECTED state of a list item is announced on selection and on focus
*we dont add
aria-selected="false"
to unselected list items as per recommendation seen here