react
react copied to clipboard
Allows asterisk in `FormControl.Label` to be adjustable
Closes: https://github.com/github/primer/issues/3263 https://github.com/github/accessibility-audits/issues/5724
Provides more flexibility to our required indicator (currently an asterisk). This PR adds the ability to change the text of the indicator, as well as hide it from AT via the new requiredIndicator prop.
Changelog
New
Adds two new props in FormControl.Label:
requiredText- Allows you to change the required indicator from '*', to the value provided. Defaults to '*'.requiredIndicator- Allows you to toggle between the indicator being present or not in the accessibility tree. Defaults to 'true'.
Rollout strategy
- [x] Patch release
- [ ] Minor release
- [ ] Major release; if selected, include a written rollout or migration plan
- [ ] None; if selected, include a brief description as to why
Testing & Reviewing
Merge checklist
- [ ] Added/updated tests
- [ ] Added/updated documentation
- [x] Added/updated previews (Storybook)
- [ ] Changes are SSR compatible
- [x] Tested in Chrome
- [ ] Tested in Firefox
- [ ] Tested in Safari
- [ ] Tested in Edge
- [ ] (GitHub staff only) Integration tests pass at github/github (Learn more about how to run integration tests)
🦋 Changeset detected
Latest commit: be9b4a69153b94da1f3c10ca7b20570898990f30
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @primer/react | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
size-limit report 📦
| Path | Size |
|---|---|
| packages/react/dist/browser.esm.js | 89.34 KB (-0.02% 🔽) |
| packages/react/dist/browser.umd.js | 89.68 KB (+0.02% 🔺) |
This is one of many ways to handle how we do required indicators in FormControl.Label. Would love any other opinions on how to make this easier for consumers :eyes:
More context: https://github.com/github/primer/issues/3263