Skip to content

Conversation

@tekno0ryder
Copy link
Contributor

@tekno0ryder tekno0ryder commented Nov 29, 2025

Closes #21093

Falsy check to render labelText and helperText prevents considering 0 (number) which is a valid input. One solution is to use explicit checks for null and undefined.

Changelog

Changed

Update labelText and helperText show conditions from falsy to null and undefined checks

Testing / Reviewing

Can be verified by setting the value of helperText or labelText to 0 (number) in storybook.

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
    - [ ] Updated documentation and storybook examples
    - [ ] Wrote passing tests that cover this change
  • Addressed any impact on accessibility (a11y)
    - [ ] Tested for cross-browser consistency
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide

@tekno0ryder tekno0ryder marked this pull request as ready for review November 29, 2025 23:20
@tekno0ryder tekno0ryder requested a review from a team as a code owner November 29, 2025 23:20
@netlify
Copy link

netlify bot commented Nov 29, 2025

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit b44a036
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/692d38d708ae0a000875951e
😎 Deploy Preview https://deploy-preview-21094--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link

netlify bot commented Nov 29, 2025

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit b44a036
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/692d38d7bab800000829a62d
😎 Deploy Preview https://deploy-preview-21094--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov
Copy link

codecov bot commented Nov 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.60%. Comparing base (786e07f) to head (b44a036).
⚠️ Report is 2 commits behind head on main.

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     
Flag Coverage Δ
main-packages 85.62% <100.00%> (+0.01%) ⬆️
web-components 96.87% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@netlify
Copy link

netlify bot commented Nov 29, 2025

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit b44a036
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/692d38d7cc76e8000848cc73
😎 Deploy Preview https://deploy-preview-21094--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

@adamalston adamalston left a 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;
Copy link
Contributor

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:

Suggested change
const hasHelper = helperText !== null && helperText !== undefined;
const hasHelper = helperText !== null && typeof helperText !== 'undefined';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: needs tests PRs that need tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: TextInput labels with a value of 0 are not rendered

3 participants