[ResourceList] Make item actions accessible #1973
Merged
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.
WHY are these changes introduced?
Fixes Shortcut actions part of #792
Shortcut actions
Smaller-breakpoint, persistent shortcut action buttons have no text equivalent for the ... icon. Screen reader users may not be able to tell what the button does.
Controls that repeat for persistent shortcut actions for each list item do not have unique text. Non-visual users may have difficulty distinguishing which resource item they relate to as they tab through the controls and hear them read.
WHAT is this pull request doing?
For item 1 the wrong attribute was being added to the button so changing it to
aria-labeltoaccessibilityLabelmakes the already translated label appear. However @dpersing you suggested a label like: "Actions for Mae Jemison". Since we don't have control over what people put in the list item in order to have that amount of detail we would need to add another prop to ResourceList which is already a bit bloated.Therefore I'm following the approach we did elsewhere: If there's is an accessibility label provided it will be "Actions for {accessibilityLabel}" if not it will just be the current translated text "Actions Dropdown"This won't actually make sense. For now, it just says "Actions Dropdown". If this is acceptable then we should keep this on our radar because I believe the ResourceList will be getting a bit of an overhaul soon.For item 2 we do have that flexibility but it is up to the user to provide the action with the right label. I updated the example to show that.
How to 🎩
yarn build-consumer polaris-styleguideto ensure the documentation renders properly.Copy-paste this code in
playground/Playground.tsx:🎩 checklist
README.mdwith documentation changes