Skip to content

feat: Added Checkbox behavior to not show invalid / warn when readOnly / disabled#20804

Merged
riddhybansal merged 20 commits into
carbon-design-system:mainfrom
FFahrenheit:ilm-issue-20728
Apr 15, 2026
Merged

feat: Added Checkbox behavior to not show invalid / warn when readOnly / disabled#20804
riddhybansal merged 20 commits into
carbon-design-system:mainfrom
FFahrenheit:ilm-issue-20728

Conversation

@FFahrenheit

@FFahrenheit FFahrenheit commented Oct 24, 2025

Copy link
Copy Markdown
Contributor

Closes #20728

Disabled invalid / warning states on Checkbox and CheckboxGroup when readOnly or disabled property is set (React + Web Components)

Changelog

New

  • Tests for react / webcomponents (Checkbox + CheckboxGroup)

Changed

  • Invalid / warning states are shown only when the input is interactive (not readOnly and not disabled)
  • Helper text remains visible when invalid/warn is suppressed by readOnly/disabled

Testing / Reviewing

  • Go to React | WC Deploy Preview > Checkbox > Default

  • Test Disabled State: Set the disabled prop to true. While disabled is true, set the invalid prop to true and confirm that the invalid styles/messages do not show up. Apply the same thing with the warn prop.

  • Test ReadOnly State: Set the readOnly prop to true. While readOnly is true, set the invalid prop to true and confirm that the invalid styles/messages do not show up. Apply the same thing with the warn prop.

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

@netlify

netlify Bot commented Oct 24, 2025

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit 69c79f8
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/69de07f2f7403d00089af0c9
😎 Deploy Preview https://deploy-preview-20804--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

netlify Bot commented Oct 24, 2025

Copy link
Copy Markdown

Deploy Preview for v11-carbon-react ready!

Name Link
🔨 Latest commit 69c79f8
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/69de07f2dddcb60008cd2992
😎 Deploy Preview https://deploy-preview-20804--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.

@netlify

netlify Bot commented Oct 24, 2025

Copy link
Copy Markdown

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 1c52078
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/69708ee6fea760000896e194
😎 Deploy Preview https://deploy-preview-20804--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.

@FFahrenheit FFahrenheit changed the title feat: Added ComboBox behavior to not show invalid / warn when readOnly / disabled feat: Added Checkbox behavior to not show invalid / warn when readOnly / disabled Oct 31, 2025
@FFahrenheit FFahrenheit marked this pull request as ready for review October 31, 2025 20:13
@FFahrenheit FFahrenheit requested a review from a team as a code owner October 31, 2025 20:13
@codecov

codecov Bot commented Nov 3, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.91%. Comparing base (349ca07) to head (69c79f8).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20804      +/-   ##
==========================================
- Coverage   94.93%   94.91%   -0.02%     
==========================================
  Files         541      541              
  Lines       45256    45289      +33     
  Branches     6336     6352      +16     
==========================================
+ Hits        42963    42986      +23     
- Misses       2161     2171      +10     
  Partials      132      132              
Flag Coverage Δ
main-packages 89.17% <100.00%> (+<0.01%) ⬆️
web-components 97.71% <100.00%> (+<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.

@maradwan26 maradwan26 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, thanks for contributing!

We recommend utilizing the internal useNormalizedInputProps to achieve this functionality

Some example usage and the associated PR

@FFahrenheit

Copy link
Copy Markdown
Contributor Author

Hi @maradwan26 will fix that. Thanks.

@heloiselui

Copy link
Copy Markdown
Contributor

@FFahrenheit thanks for contributing! It seems the web components tests are failing, could you check this?

@heloiselui heloiselui requested a review from maradwan26 April 7, 2026 18:46
@heloiselui

Copy link
Copy Markdown
Contributor

Hey @maradwan26 @riddhybansal, could you recheck this PR? I made some updates and want to confirm everything looks okay. Thanks!!

@maradwan26 maradwan26 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @heloiselui, just added a commit to update the dates

Comment thread packages/react/src/components/Checkbox/__tests__/Checkbox-test.js Outdated
Comment thread packages/react/src/components/Checkbox/Checkbox.tsx Outdated
Comment thread packages/react/src/components/CheckboxGroup/CheckboxGroup-test.js Outdated
Comment thread packages/web-components/src/components/checkbox/__tests__/checkbox-group-test.js Outdated
Comment thread packages/web-components/src/components/checkbox/__tests__/checkbox-test.js Outdated
Comment thread packages/web-components/src/components/checkbox/checkbox-group.ts Outdated
Comment thread packages/web-components/src/components/checkbox/checkbox.scss Outdated
Co-authored-by: Mahmoud <132728978+maradwan26@users.noreply.github.com>

@riddhybansal riddhybansal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@riddhybansal riddhybansal added this pull request to the merge queue Apr 15, 2026
Merged via the queue into carbon-design-system:main with commit 27f2292 Apr 15, 2026
39 checks passed
@github-project-automation github-project-automation Bot moved this from 🚦 In Review to ✅ Done in Design System Apr 15, 2026
MarianaAa01 pushed a commit to MarianaAa01/carbon that referenced this pull request May 29, 2026
…y / disabled (carbon-design-system#20804)

* fix: disable invalid / warn on readOnly / disabled Checkbox carbon-design-system#20728

* fix: disable invalid / warn on readOnly / disabled Checkbox (WC) carbon-design-system#20728

* feat: invalid / warn on disabled tests carbon-design-system#20728

* fix: storybook wc changes

* fix(checkbox): normalize checkbox in react

* test(checkbox): add tests

* fix(checkbox): normalize checkbox in wc

* test(checkbox): add tests in wc

* Apply suggestions from code review

Co-authored-by: Mahmoud <132728978+maradwan26@users.noreply.github.com>

---------

Co-authored-by: Heloise Lui <71858203+heloiselui@users.noreply.github.com>
Co-authored-by: Riddhi Bansal <41935566+riddhybansal@users.noreply.github.com>
Co-authored-by: “heloiselui” <helolui27@gmail.com>
Co-authored-by: Mahmoud <132728978+maradwan26@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

[Checkbox]: Disallow invalid & warn when readonly or disabled

4 participants