-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CheckboxGroup and RadioGroup components #830
Conversation
🦋 Changeset detectedLatest commit: b535c93 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
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 |
🟢 No design token changes found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 16 out of 26 changed files in this pull request and generated no suggestions.
Files not reviewed (10)
- packages/react/src/forms/InputGroup/InputGroup.module.css: Language not supported
- packages/react/src/forms/RadioGroup/RadioGroup.tsx: Evaluated as low risk
- packages/react/src/forms/CheckboxGroup/CheckboxGroup.stories.tsx: Evaluated as low risk
- packages/react/src/forms/CheckboxGroup/CheckboxGroup.test.tsx: Evaluated as low risk
- packages/react/src/forms/index.ts: Evaluated as low risk
- packages/react/src/forms/CheckboxGroup/index.ts: Evaluated as low risk
- .changeset/popular-seas-yawn.md: Evaluated as low risk
- packages/react/src/forms/InputGroup/index.ts: Evaluated as low risk
- packages/react/src/forms/RadioGroup/RadioGroup.stories.tsx: Evaluated as low risk
- packages/react/src/forms/RadioGroup/index.ts: Evaluated as low risk
Comments skipped due to low confidence (3)
packages/react/src/forms/CheckboxGroup/CheckboxGroup.visual.spec.ts:8
- Consider removing the eslint-disable comment and ensuring that the code adheres to the i18n-text/no-en rule.
// eslint-disable-next-line i18n-text/no-en
packages/react/src/forms/InputGroup/InputGroup.tsx:20
- The error message should be more concise and specific, e.g., 'useInputGroup must be used within an InputGroupProvider.'
throw new Error('useInputGroup must be used within an InputGroupProvider. Did you forget to wrap your component in a <InputGroupProvider>?')
packages/react/src/forms/CheckboxGroup/CheckboxGroup.tsx:14
- [nitpick] Consider adding a comment explaining that CheckboxGroup is currently just an alias for InputGroup to provide context for future maintainers.
export const CheckboxGroup = InputGroup
Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more
🟢 No visual differences foundOur visual comparison tests did not find any differences in the UI. |
5be3a2e
to
810a183
Compare
packages/react/src/forms/CheckboxGroup/CheckboxGroup.examples.stories.tsx
Show resolved
Hide resolved
} | ||
|
||
.ControlGroup__validation--animate-in { | ||
animation: 170ms ControlGroupValidationFadeIn cubic-bezier(0.44, 0.74, 0.36, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking:
Appreciate these are probably from FormControl. We have newer animation-specific variables now, but none that match directly to this.
@joshfarrant, how close are these values to what's above? Can we sub them out? Can also do this in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just gone ahead and updated it to brand-animation-duration-glide
expect(results).toHaveNoViolations() | ||
}) | ||
|
||
describe('aria-describedby', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit and more of a style preference: do we need the nested describe block? Could we instead rename the title of each test case to be more descriptive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is more style and consistency thing. Having it all in one title means the purpose of test case can be understood in isolation, and without context. Nested describes assume that it's also labelled appropriately enough, which might not always be the case. I got caught out here for example, as I was reading the titles without realising they were referring to a specific aspect of the component aria-describedby
. As it's not how we write our test cases everywhere else, I'd prefer to keep it consistent for readability reasons, though we can fix this later too so non-blocking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, updated 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @joshfarrant, these new components are great ✨
Summary
Adds
CheckboxGroup
andRadioGroup
components which, for the time being, are just implementations of the new privateControlGroup
component. These components allow us to groupRadio
andCheckbox
components using a<fieldset>
and label them with a<legend>
, providing a more accessible and semantic way to group related form elements.List of notable changes:
ControlGroup
component (alternate name suggestions welcome)CheckboxGroup
andRadioGroup
components, tests, and storiesStill to do (in future PRs)
What should reviewers focus on?
Steps to test:
Supporting resources (related issues, external links, etc):
Contributor checklist:
update snapshots
label to the PR)Reviewer checklist:
Screenshots: