Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve a11y attributes and support for id props in dropdown componen…
…ts (#2257) ## Summary: - ActionMenu: Adds new optional props: `id` and `dropdownId`. If not provided, they are auto-generated. Ids are applied and the dropdownId is now used for the `aria-controls` attribute for the opener - SingleSelect and MultiSelect: Adds optional `dropdownId` prop. If `id` or `dropdownId` props are not provided, ids for these will be auto-generated. The opener's `aria-controls` attribute is set to the dropdown id - Make sure default and custom openers have all the correct attributes (`aria-haspopup`, `aria-expanded`). This addresses warnings in the Storybook a11y add on Issue: WB-1714 ## Test plan: - Review documentation ActionMenu, SingleSelect, and MultiSelect - `id` and `dropdownId` props - Docs for `With Custom Opener` example - Confirm in ActionMenu, SingleSelect, and MultiSelect: - When the `id` and `dropdownId` props are not set, there is an auto-generated id for each of these on the opener and the dropdown. The opener should also have `aria-controls` set to the dropdown id - When the `id` and `dropdownId` props are set, they should be the id on the opener and the dropdown elements. The opener should also have `aria-controls` set to the provided `dropdownId` - The opener should have the `aria-haspopup` and `aria-expanded` attributes set - All of the above should apply also when a custom opener is used Author: beaesguerra Reviewers: jandrade Required Reviewers: Approved By: jandrade Checks: ✅ codecov/project, ✅ Lint (ubuntu-latest, 20.x), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Test (ubuntu-latest, 20.x, 2/2), ✅ Test (ubuntu-latest, 20.x, 1/2), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ✅ gerald, ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 20.x), ✅ Test (ubuntu-latest, 20.x, 2/2), ✅ Lint (ubuntu-latest, 20.x), ✅ Test (ubuntu-latest, 20.x, 1/2), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Chromatic - Build on regular PRs / chromatic (ubuntu-latest, 20.x), ⏭️ Publish npm snapshot, ⏭️ Chromatic - Skip on Release PR (changesets), ✅ Prime node_modules cache for primary configuration (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ gerald, ⏭️ dependabot Pull Request URL: #2257
- Loading branch information