-
Notifications
You must be signed in to change notification settings - Fork 129
Add default CloseButton label #3393
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: 910a15d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Size Change: -573 B (-0.08%) Total Size: 752 kB
ℹ️ View Unchanged
|
6a6f8a1 to
c6e3a62
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3393 +/- ##
==========================================
- Coverage 93.89% 93.89% -0.01%
==========================================
Files 195 195
Lines 4406 4403 -3
Branches 1708 1706 -2
==========================================
- Hits 4137 4134 -3
Misses 244 244
Partials 25 25
🚀 New features to boost your workflow:
|
| render(<CloseButton ref={ref}>Close</CloseButton>); | ||
| const button = screen.getByRole('button', { name: 'Close' }); |
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.
Shall we clean up the AccessibilityError for the missing clearLabel as well?
| * Important for accessibility. | ||
| */ | ||
| removeButtonLabel: string; | ||
| removeButtonLabel?: string; |
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.
This prop should remain required unless we add default translations, since "Close" is appropriate as a label here.
Addresses DSYS-XXXX
Purpose
This PR centralizes the translation for the “Close” label required by the CloseButton component by moving it directly into the component. Many components across our apps (including several in CUI) previously duplicated this translation, requiring each consumer to provide its own label. This would reduce effort required from developers to provide the label and reduce overall bundle size.
Approach and changes
added translations under CloseButton/translations
removed translations for the close button from the Dialog component
made the label optional for components that use the CloseButton component:
Some form components, such as the SearchInput and the AutocompleteInput, use the CloseButton for clearing text inputs. These have their own translations as the purpose of the button is different (clearing vs closing) and are not concerned with this change.
For some components, the appearance of the CloseButton is not longer conditioned by the presence of the close label, but only by the presence of the button's callback (CardHeader, NotificationBanner, NotificationInline, Tag, SidePanel)
Definition of done