LG-5835: Rm dupe aria-* attributes in FormField#3417
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.
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 |
| @@ -0,0 +1,7 @@ | |||
| --- | |||
| '@leafygreen-ui/tokens': patch | |||
There was a problem hiding this comment.
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 |
| '@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 |
There was a problem hiding this comment.
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.
Nit: also removes duplicate readonly attribute
| 'aria-label': ariaLabelProp, | ||
| 'aria-labelledby': ariaLabelledbyProp, | ||
| 'aria-invalid': ariaInvalidProp, | ||
| readOnly, |
There was a problem hiding this comment.
I think we should match everything thats returned with input props:
There was a problem hiding this comment.
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.
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.
can we also add test specs for this fix?
| @@ -0,0 +1,5 @@ | |||
| --- | |||
shaneeza
left a comment
There was a problem hiding this comment.
The comments left by Stephen and me should be addressed before merging in.

✍️ 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