-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: modify show condition for labelText and helperText
#21094
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
✅ Deploy Preview for v11-carbon-web-components ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #21094 +/- ##
=======================================
Coverage 92.60% 92.60%
=======================================
Files 515 515
Lines 38222 38215 -7
Branches 5833 5798 -35
=======================================
- Hits 35394 35389 -5
+ Misses 2678 2677 -1
+ Partials 150 149 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
✅ Deploy Preview for carbon-elements ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
adamalston
left a comment
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 you add tests?
| const checkboxGroupInstanceId = useId(); | ||
|
|
||
| const helperId = !helperText | ||
| const hasHelper = helperText !== null && helperText !== undefined; |
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 suggestion applies here and elsewhere:
| const hasHelper = helperText !== null && helperText !== undefined; | |
| const hasHelper = helperText !== null && typeof helperText !== 'undefined'; |
Closes #21093
Falsy check to render
labelTextandhelperTextprevents considering 0 (number) which is a valid input. One solution is to use explicit checks fornullandundefined.Changelog
Changed
Update
labelTextandhelperTextshow conditions from falsy tonullandundefinedchecksTesting / Reviewing
Can be verified by setting the value of
helperTextorlabelTextto 0 (number) in storybook.PR Checklist
As the author of this PR, before marking ready for review, confirm you:
- [ ] Updated documentation and storybook examples- [ ] Wrote passing tests that cover this change- [ ] Tested for cross-browser consistencyMore details can be found in the pull request guide