-
Notifications
You must be signed in to change notification settings - Fork 73
LG-5835: Rm dupe aria-* attributes in FormField #3417
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: cc23535 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 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 |
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.
Pull request overview
This PR removes duplicate aria-* attributes in the FormField component by explicitly extracting them from props before spreading the rest object. This ensures aria-label, aria-labelledby, aria-invalid, and readOnly are not passed twice to child components.
Key Changes
- Extracted aria-label, aria-labelledby, aria-invalid, and readOnly from props destructuring
- Explicitly passed these attributes to formFieldInputContainerProps instead of via spread
- Added a changeset for @leafygreen-ui/tokens (appears to be in wrong PR)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/form-field/src/FormField/FormField.tsx | Extracted aria attributes and readOnly from props to prevent duplication when spreading rest |
| .changeset/calm-icons-shine.md | Added changeset for tokens package color updates |
.changeset/calm-icons-shine.md
Outdated
| @@ -0,0 +1,7 @@ | |||
| --- | |||
| '@leafygreen-ui/tokens': patch | |||
Copilot
AI
Dec 23, 2025
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.
The changeset references '@leafygreen-ui/tokens' but this PR modifies '@leafygreen-ui/form-field'. The package name should be '@leafygreen-ui/form-field' to match the changed component.
| '@leafygreen-ui/tokens': patch | |
| '@leafygreen-ui/form-field': patch |
.changeset/calm-icons-shine.md
Outdated
| '@leafygreen-ui/tokens': patch | ||
| --- | ||
|
|
||
| Updated color tokens: | ||
| - Adds border info, onInfo, warning, and onWarning tokens | ||
| - Adds text info, onInfo, warning, and onWarning tokens No newline at end of file |
Copilot
AI
Dec 23, 2025
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.
The changeset description mentions color token updates, but this PR removes duplicate aria-* attributes in FormField. The description should explain the actual changes: 'Fixes duplicate aria-* attributes (aria-label, aria-labelledby, aria-invalid) and readOnly prop being passed to child components in FormField.'
| '@leafygreen-ui/tokens': patch | |
| --- | |
| Updated color tokens: | |
| - Adds border info, onInfo, warning, and onWarning tokens | |
| - Adds text info, onInfo, warning, and onWarning tokens | |
| '@leafygreen-ui/form-field': patch | |
| --- | |
| Fixes duplicate aria-* attributes (aria-label, aria-labelledby, aria-invalid) and readOnly prop being passed to child components in FormField. |
|
Size Change: +97 B (+0.01%) Total Size: 1.83 MB
ℹ️ View Unchanged
|
f3853b4 to
54c562e
Compare
|
Coverage after merging brooke/form-field into main will be
Coverage Report for Changed Files
|
| '@leafygreen-ui/form-field': patch | ||
| --- | ||
|
|
||
| Removes duplicate `aria-*` attributes |
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: also removes duplicate readonly attribute
| 'aria-label': ariaLabelProp, | ||
| 'aria-labelledby': ariaLabelledbyProp, | ||
| 'aria-invalid': ariaInvalidProp, | ||
| readOnly, |
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 think we should match everything thats returned with input props:
| export interface FormFieldInputElementProps { | |
| id: string; | |
| 'aria-describedby': string; | |
| 'aria-labelledby'?: string; | |
| 'aria-label'?: string; | |
| 'aria-disabled'?: boolean; | |
| 'aria-invalid'?: FormFieldProps['aria-invalid']; | |
| readOnly?: boolean; |
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.
can we also add test specs for this fix?
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| '@leafygreen-ui/form-field': patch | |||
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 believe if this is a patch bump, it won't propagate to downstream dependencies unless they are explicitly listed here
| 'aria-label': ariaLabelProp, | ||
| 'aria-labelledby': ariaLabelledbyProp, | ||
| 'aria-invalid': ariaInvalidProp, | ||
| readOnly, |
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.
can we also add test specs for this fix?
| @@ -0,0 +1,5 @@ | |||
| --- | |||
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.

✍️ Proposed changes
🎟 Jira ticket: LG-5835
✅ Checklist
For new components
For bug fixes, new features & breaking changes
pnpm changesetand documented my changes🧪 How to test changes