Skip to content

Storybook: Replace implicit actions with explicit ones #70589

Closed
im3dabasia wants to merge 2 commits intoWordPress:trunkfrom
im3dabasia:try/explicit-action-declaration-storybook
Closed

Storybook: Replace implicit actions with explicit ones #70589
im3dabasia wants to merge 2 commits intoWordPress:trunkfrom
im3dabasia:try/explicit-action-declaration-storybook

Conversation

@im3dabasia
Copy link
Copy Markdown
Contributor

What?

Closes #60660

Replaces implicit action args (matched via argTypesRegex) with explicit fn() spies from @storybook/test in stories. Some components had there stories updated in this PR

Why?

Storybook 8 removes support for implicit action args via argTypesRegex. Explicit fn() spies are now the recommended approach for better testing, portability, and future-proofing.

How?

Updated stories that were relying on argTypesRegex to instead use explicit actions.

Testing Instructions

  1. Run npm run storybook:dev.
  2. Verify storybook builds
  3. Open affected component stories.
  4. Test every component or docs page to ensure nothing breaks.
  5. Confirm events still show in the actions panel.

@im3dabasia im3dabasia changed the title [WIP] Storybook: Replace implicit actions with explicit ones Storybook: Replace implicit actions with explicit ones Jul 2, 2025
@im3dabasia im3dabasia marked this pull request as ready for review July 2, 2025 06:29
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 2, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@t-hamano t-hamano added [Type] Code Quality Issues or PRs that relate to code quality Storybook Storybook and its stories for components labels Jul 3, 2025
Copy link
Copy Markdown
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! All of the components appear to have been refactored appropriately.

It looks like the following three have not yet been updated; they need to be addressed as well, right?

actions: { argTypesRegex: '^on.*' },

actions: { argTypesRegex: '^on.*' },

@tyxla
Copy link
Copy Markdown
Member

tyxla commented Jul 4, 2025

Thanks for this work @im3dabasia! Feel free to also revert 7bfce92 which I believe will also effectively close #67834 (kudos to @t-hamano for bring it up).

@im3dabasia
Copy link
Copy Markdown
Contributor Author

Thanks for the feedback,

  1. Navigation and RadioGroup component's have been deprecated after this Navigation: Soft deprecate component #59182 and RadioGroup: Mark as deprecated #45389 respectively. I thought it would be best to wait for feedback before making changes in deprecated areas of the repo.

  2. CircularOptionPicker does not have any actions appearing in the storybook actions area, checked the props as well. I'll remove this as it is not needed.

@t-hamano
Copy link
Copy Markdown
Contributor

t-hamano commented Jul 8, 2025

  1. Navigation and RadioGroup component's have been deprecated after this Navigation: Soft deprecate component #59182 and RadioGroup: Mark as deprecated #45389 respectively. I thought it would be best to wait for feedback before making changes in deprecated areas of the repo.

This PR is to remove fields that will be deprecated in the future in story definitions. I don't think it matters if the component itself is deprecated or not.

@mirka mirka requested a review from a team November 1, 2025 04:27
@aduth
Copy link
Copy Markdown
Member

aduth commented Nov 3, 2025

Hey @im3dabasia 👋 Checking in on this pull request, would you be able to make the changes @t-hamano mentioned relating to the Navigation and RadioGroup components, and rebase the branch to resolve existing conflicts?

@t-hamano
Copy link
Copy Markdown
Contributor

I will close this PR in favor of #73502.

@t-hamano t-hamano closed this Nov 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storybook Storybook and its stories for components [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Storybook: Replace implicit actions with explicit ones

4 participants