Skip to content

fix(Form): add Storybook controls - #22852

Open
Subhom1 wants to merge 1 commit into
carbon-design-system:mainfrom
Subhom1:fix-form-storybook-controls-20924
Open

fix(Form): add Storybook controls#22852
Subhom1 wants to merge 1 commit into
carbon-design-system:mainfrom
Subhom1:fix-form-storybook-controls-20924

Conversation

@Subhom1

@Subhom1 Subhom1 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Closes #20924

Adds operable React Storybook controls for the native properties exposed by Form. Both the default and AI-label stories now support a custom class name, accessible label, and submit action while preventing Storybook submissions from navigating away.

Changelog

New

  • Added controls for the Form class name and accessible label.
  • Added a submit action to both React Form stories.

Changed

  • Updated the default Form story to pass Storybook args to the rendered form.
  • Updated the AI-label story to apply Form controls to both standard and fluid forms.
  • Prevented story form submissions from triggering page navigation.
  • Preserved all existing AI-label and child validation controls.

Removed

  • None.

Testing / Reviewing

  1. Use the repository Node version and start React Storybook:

    nvm use
    yarn workspace @carbon/react storybook
    
  2. Open Components/Form.

  3. In Default, verify the class-name control updates the form class and the accessible-label control updates the form’s accessible name.

  4. Submit the form and confirm onSubmit appears in Actions without leaving the story.

  5. Open With AI label and repeat the Form checks for both the standard and fluid forms.

  6. Confirm the existing AI-label, disabled, invalid, and warning controls still work.

  7. Run the focused checks:

    yarn jest packages/react/src/components/Form/Form-test.js --runInBand
    yarn workspace @carbon/react storybook:build
    npx --yes serve -l 3000 packages/react/storybook-static
    CI=1 yarn playwright test e2e/components/Form/Form-test.avt.e2e.js --project chromium
    yarn prettier --check packages/react/src/components/Form/Form.stories.js
    

The Web Components cds-form element has no configurable component properties. Its default story therefore has no meaningful controls to add, while its AI-label story already exposes working child-state controls.

Test Screenshots
Screenshot 2026-08-01 at 1 25 48 a m

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](https://github.com/carbon-design-system/carbon/blob/main/docs/guides/reviewing-pull-requests.md).

@Subhom1
Subhom1 requested a review from a team as a code owner August 1, 2026 00:26
@netlify

netlify Bot commented Aug 1, 2026

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit fb7462b
🔍 Latest deploy log https://app.netlify.com/projects/v3-carbon-web-components/deploys/6a6d3d21d71ef40008acd0d1
😎 Deploy Preview https://deploy-preview-22852--v3-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@netlify

netlify Bot commented Aug 1, 2026

Copy link
Copy Markdown

Deploy Preview for v2-carbon-react ready!

Name Link
🔨 Latest commit fb7462b
🔍 Latest deploy log https://app.netlify.com/projects/v2-carbon-react/deploys/6a6d3d2142ec600008a0ae83
😎 Deploy Preview https://deploy-preview-22852--v2-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@netlify

netlify Bot commented Aug 1, 2026

Copy link
Copy Markdown

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit fb7462b
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/6a6d3d211614c10008380d9b
😎 Deploy Preview https://deploy-preview-22852--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@netlify

netlify Bot commented Aug 1, 2026

Copy link
Copy Markdown

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

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

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@netlify

netlify Bot commented Aug 1, 2026

Copy link
Copy Markdown

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit fb7462b
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/6a6d3d212e885a0008426c90
😎 Deploy Preview https://deploy-preview-22852--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@codecov

codecov Bot commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.59%. Comparing base (cf4d689) to head (fb7462b).
⚠️ Report is 19 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #22852      +/-   ##
==========================================
- Coverage   89.59%   89.59%   -0.01%     
==========================================
  Files         582      582              
  Lines       53277    53317      +40     
  Branches     7259     7309      +50     
==========================================
+ Hits        47736    47770      +34     
- Misses       5404     5410       +6     
  Partials      137      137              
Flag Coverage Δ
main-packages 87.61% <ø> (+<0.01%) ⬆️
web-components 90.25% <ø> (-0.01%) ⬇️

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

☔ View full report in Codecov by Harness.
📢 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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Form]: add controls args to every story

1 participant