Skip to content

feat(storybook): globally filter controls and remove usages of table: { disable: true }#20544

Merged
maradwan26 merged 5 commits into
carbon-design-system:mainfrom
maradwan26:storybook-controlfiltering-enhancement
Sep 25, 2025
Merged

feat(storybook): globally filter controls and remove usages of table: { disable: true }#20544
maradwan26 merged 5 commits into
carbon-design-system:mainfrom
maradwan26:storybook-controlfiltering-enhancement

Conversation

@maradwan26

@maradwan26 maradwan26 commented Sep 17, 2025

Copy link
Copy Markdown
Contributor

Closes #20354

This enhancement globally filters controls in the React storybook and removes previous usages of table: { disable: true }, in favour of Storybook's include/exclude control filtering, while also maintaining all argTypes for documentation purposes in the Overview pages.

The following controls are globally filtered:

  • className
  • children
  • as
  • decorator
  • slug
  • ref
  • ariaLabel
    • This is because ariaLabel has been deprecated in favour of aria-label
  • onChange, onClick, on....

Changelog

New

  • Added an argTypesEnhancers to preview.js that takes in an array of strings/regexes "GLOBAL_EXCLUDED_CONTROLS" of controls we want to globally filter out by applying table: { disable: true }, to them

    • This method was used due to a limitation with Storybook's parameters. Globally filtering controls via parameters = { controls: { exclude: .... }, would block the ability to filter controls specific to a single component's stories, the global filter would get overwritten. This then leads to us having to either reapply the global filter on top of a specific filter for each story, or use table: { disable: true },, both of which are methods that weaken this enhancement and its purpose. argTypesEnhancers allows for developers to use story specific control filtering with no issue.

    • The filter also ensures that controls/args aren't filtered out of the Overview pages, as even though they may not be used in the stories, they are useful as documentation for users.

Changed

  • Changed usages of table: { disable: true }, to parameters = { controls: { exclude/include: .... }, throughout the codebase

Removed

  • Removed usages of table: { disable: true }, to disable controls throughout codebase
  • Removed usages of table: { disable: true }, that hid argType from the Overview page throughout the codebase
    • There were few exceptions to this. Like args that cannot be used with the current component (e.g. FluidTextArea and helperText, hideLabel, and light) either due to the args being inherited from a parent component, or not being supported (light).

Testing / Reviewing

  • Stories should have the globally filtered controls not shown in their controls table
  • ArgTypes should still be visible in Overview Page
  • There shouldn't be unnecessary usages of table: { disable: true }, in the storybook files in this branch
  • Mention if there should be more/less controls added to the list of globally filtered controls
  • There should be no regression
  • CI should pass

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

@maradwan26 maradwan26 requested a review from a team as a code owner September 17, 2025 15:23
@maradwan26 maradwan26 requested review from a team, riddhybansal and tay1orjones September 17, 2025 15:23
@maradwan26 maradwan26 changed the title Storybook controlfiltering enhancement feat(storybook): globally filter controls and refactor old usages of table: { disable: true } Sep 17, 2025
@maradwan26 maradwan26 changed the title feat(storybook): globally filter controls and refactor old usages of table: { disable: true } feat(storybook): globally filter controls and remove old usages of table: { disable: true } Sep 17, 2025
@maradwan26 maradwan26 added the package: @carbon/react @carbon/react label Sep 17, 2025
@maradwan26 maradwan26 changed the title feat(storybook): globally filter controls and remove old usages of table: { disable: true } feat(storybook): globally filter controls and remove usages of table: { disable: true } Sep 17, 2025
@netlify

netlify Bot commented Sep 17, 2025

Copy link
Copy Markdown

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit 377acf0
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/68d560dda4d5ba00087e0fb0
😎 Deploy Preview https://deploy-preview-20544--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.

@netlify

netlify Bot commented Sep 17, 2025

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit 377acf0
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/68d560dd6d1f340008812485
😎 Deploy Preview https://deploy-preview-20544--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.

@codecov

codecov Bot commented Sep 17, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.93%. Comparing base (30b4f87) to head (377acf0).
⚠️ Report is 230 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20544      +/-   ##
==========================================
+ Coverage   91.39%   91.93%   +0.54%     
==========================================
  Files         485      484       -1     
  Lines       31370    32772    +1402     
  Branches     5430     5550     +120     
==========================================
+ Hits        28670    30129    +1459     
+ Misses       2547     2496      -51     
+ Partials      153      147       -6     
Flag Coverage Δ
main-packages 85.25% <ø> (+0.32%) ⬆️
web-components 97.24% <ø> (+0.08%) ⬆️

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

netlify Bot commented Sep 17, 2025

Copy link
Copy Markdown

Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 377acf0
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/68d560dd5b504d0008bf6b19
😎 Deploy Preview https://deploy-preview-20544--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.

@tay1orjones tay1orjones left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This cleans things up so much 🙌 LGTM

* Args matching elements in the GLOBAL_EXCLUDED_CONTROLS array are not shown in the
* `controls` table
*/
export const argTypesEnhancers = [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Worth noting this appears to be considered an experimental API storybookjs/storybook#30749

@maradwan26 maradwan26 added this pull request to the merge queue Sep 25, 2025
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 25, 2025
Merged via the queue into carbon-design-system:main with commit 6e01d87 Sep 25, 2025
42 of 43 checks passed
@maradwan26 maradwan26 deleted the storybook-controlfiltering-enhancement branch September 25, 2025 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Use control filtering in Storybook to filter out controls we want to ignore

3 participants