Skip to content

Writing Settings: Import ToggleControl from @wordpress/components#48186

Merged
simison merged 2 commits intotrunkfrom
claude/busy-goldberg-1c10d1
Apr 19, 2026
Merged

Writing Settings: Import ToggleControl from @wordpress/components#48186
simison merged 2 commits intotrunkfrom
claude/busy-goldberg-1c10d1

Conversation

@ilonagl
Copy link
Copy Markdown
Contributor

@ilonagl ilonagl commented Apr 19, 2026

Refs #48160

Proposed changes

  • Import ToggleControl directly from @wordpress/components in the Jetpack plugin Writing settings page (writing-media.jsx, custom-content-types.jsx) instead of the @automattic/jetpack-components re-export.
  • Drop the wrapper-only toggling={} prop (accepting a minor in-flight UX loss — disabled guards still prevent double-submit).
  • Add __nextHasNoMarginBottom={ true } on every call site to silence the deprecation warning. Margin behavior is unchanged — the wrapper already passed this flag internally.
  • Drop the unsupported disabledReason prop on the testimonial/portfolio toggles and the dead helper vars that computed those strings. The wrapper was silently dropping disabledReason too (it's not in the wrapper's destructured props), so this is a no-op for current users.
  • Part of the @automattic/jetpack-components consumer migration tracked in #48160. Follows the same pattern used for the Security settings in #48179.

Out of scope:

  • ModuleToggle usages (still route through _inc/client/components/module-toggle, which imports from @automattic/jetpack-components). Follow-up.
  • The js-packages ToggleControl wrapper at projects/js-packages/components/components/toggle-control/ is left untouched.

Related product discussion/links

N/A — no standalone P2/Slack thread. Tracked under #48160.

Does this pull request change what data or activity we track or use?

No.

Screenshots

Captured on a live Jurassic Ninja site at admin.php?page=jetpack#/writing at 1440×900. The "before" is trunk rsync'd to JN; the "after" is this branch rsync'd to the same site.

The two PNGs are byte-identical — expected for a pure import swap. The @automattic/jetpack-components wrapper re-exported the same @wordpress/components ToggleControl with __nextHasNoMarginBottom={ true } as a default, so the at-rest visual output matches. The behavioral difference (no mid-save opacity via toggling) only shows during an active save and is not captured here.

Surface Before (baseline on JN) After (this branch on JN)
Writing settings (Media / Carousel toggles) before after

JN rsync target: plugins/jetpack · Baseline: trunk · JN site: thoughtfully-remarkable-device.jurassic.ninja

Note: the Testimonials / Portfolios toggles in custom-content-types.jsx are also migrated here but aren't shown above because the JN site is on a block theme (twentytwentyfour) and Jetpack_Testimonial::site_should_display_testimonials() returns false for FSE themes without the option explicitly enabled. The code path is covered by the build + typecheck + JS test gates.

Testing instructions

  1. Check out the branch, run pnpm jetpack build --deps plugins/jetpack, and load the Jetpack plugin on a site using a classic theme (so the Custom Content Types card renders).
  2. Navigate to Jetpack → Settings → Writing.
  3. In the Media card, toggle Carousel on, then verify the "Show photo Exif metadata in carousel" and "Show comments area in carousel" toggles render, are enabled, and persist when clicked.
  4. In the Custom Content Types card, verify the Testimonials and Portfolios toggles render and persist when clicked.
  5. Open the browser console and confirm no __nextHasNoMarginBottom deprecation warnings appear when opening the Writing tab.

Sign-off: changelog entry added for plugins/jetpack; visual diff reviewed (byte-identical at rest — mid-save opacity change is the expected behavior delta).

Direct 1:1 swap that drops `toggling={}` (minor in-flight UX loss)
and adds `__nextHasNoMarginBottom={ true }` per call site. Part of
jetpack-components consumer migration (#48160). ModuleToggle usages
and the js-packages wrapper are left alone.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 19, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the claude/busy-goldberg-1c10d1 branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack claude/busy-goldberg-1c10d1

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ Admin Page React-powered dashboard under the Jetpack menu labels Apr 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 19, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: May 5, 2026
    • Code freeze: May 4, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@ilonagl ilonagl self-assigned this Apr 19, 2026
@dhasilva dhasilva marked this pull request as ready for review April 19, 2026 16:20
@jp-launch-control
Copy link
Copy Markdown

jp-launch-control bot commented Apr 19, 2026

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/plugins/jetpack/_inc/client/writing/custom-content-types.jsx 0/27 (0.00%) 0.00% -3 💚

Full summary · PHP report · JS report

@dhasilva dhasilva added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Apr 19, 2026
@github-actions github-actions bot added [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. and removed [Status] Needs Review This PR is ready for review. labels Apr 19, 2026
dhasilva
dhasilva previously approved these changes Apr 19, 2026
Copy link
Copy Markdown
Contributor

@dhasilva dhasilva left a comment

Choose a reason for hiding this comment

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

All good!

@dhasilva dhasilva added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Apr 19, 2026
Comment thread projects/plugins/jetpack/_inc/client/writing/custom-content-types.jsx Outdated
The wrapper silently dropped the prop too — upstream @wordpress/components
ToggleControl has no disabledReason. Remove the dead helper vars that
computed those reasons.
Copy link
Copy Markdown
Member

@simison simison left a comment

Choose a reason for hiding this comment

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

Works 👍

I think we should look if to just hide Portfolio etc toggles instead of merely disabling them on block themes, but not the point of this PR.

@simison simison merged commit 0a6a798 into trunk Apr 19, 2026
75 checks passed
@simison simison deleted the claude/busy-goldberg-1c10d1 branch April 19, 2026 20:11
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Apr 19, 2026
@github-actions github-actions bot added this to the jetpack/15.8 milestone Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Admin Page React-powered dashboard under the Jetpack menu [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants