-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add validation props to MultiSelect and share logic with SingleSelect (…
…#2378) ## Summary: - Refactor SingleSelect validation logic to useSelectValidation hook - Adding validation related props to MultiSelect: validate, onValidate, required. (error prop was already supported) - Make sure aria-invalid is set if it is in an error state Issue: WB-1782 ## Test plan: - MultiSelect docs are reviewed `?path=/docs/packages-dropdown-multiselect--docs` - Validation works as expected in MultiSelect (see docs for more details on validation behaviour): - Error (`?path=/story/packages-dropdown-multiselect--error`) - Required (`?path=/story/packages-dropdown-multiselect--required`) - Error from Validation (`?path=/story/packages-dropdown-multiselect--error-from-validation`) - MultiSelect continues to work as expected (including keyboard interactions) - SingleSelect continues to work as expected (including validation) Author: beaesguerra Reviewers: beaesguerra, jandrade Required Reviewers: Approved By: jandrade Checks: ✅ Chromatic - Get results on regular PRs (ubuntu-latest, 20.x), ✅ Test / Test (ubuntu-latest, 20.x, 2/2), ✅ Test / Test (ubuntu-latest, 20.x, 1/2), ✅ Lint / Lint (ubuntu-latest, 20.x), ✅ Check build sizes (ubuntu-latest, 20.x), ✅ Chromatic - Build on regular PRs / chromatic (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ⏭️ 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: #2378
- Loading branch information
1 parent
71e7086
commit bc4da9e
Showing
10 changed files
with
2,201 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@khanacademy/wonder-blocks-dropdown": minor | ||
--- | ||
|
||
# MultiSelect | ||
|
||
- Add `required`, `validate`, and `onValidate` props to support validation. | ||
- Set `aria-invalid` on the opener if it is in an error state | ||
- Share validation logic with SingleSelect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.