Skip to content

Newsletter: Migrate ToggleControl off @automattic/jetpack-components - #48176

Closed
ilonagl wants to merge 1 commit into
trunkfrom
issue-48160/migrate-newsletter-toggle
Closed

ilonagl wants to merge 1 commit into
trunkfrom
issue-48160/migrate-newsletter-toggle

Conversation

@ilonagl

@ilonagl ilonagl commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Proposed changes

  • Swap ToggleControl imports from @automattic/jetpack-components to @wordpress/components across the Jetpack Newsletter settings screen (plugins/jetpack/_inc/client/newsletter/), covering the Newsletter, Subscriptions, Email configuration, and Newsletter categories sections.
  • Drop the custom toggling prop (and a pre-existing toogling typo that was never doing anything). Every call site already sets disabled={ isSavingAnyOption( … ) }, so the toggle remains unclickable during saves — we lose only the wrapper's optimistic visual flip, matching the standard wp-admin behavior.
  • Add __nextHasNoMarginBottom on each migrated call site to keep the wrapper's default margin-bottom behavior.
  • Leave the ToggleControl re-export in @automattic/jetpack-components alone — dead-code removal is out of scope for this narrow consumer migration (see #48160 for the tracking issue).

Other information

Part of the #48160 migration off @automattic/jetpack-components. Follows the same shape as #48170 (RadioControl) and #48156 (Badge).

Note: the old Newsletter settings tab in the Jetpack admin SPA is hidden by default since #47750 (jetpack_wp_admin_newsletter_settings_enabled filter defaults to true, redirecting users to the new dedicated Newsletter page). The old screen still renders when a site filters that back to false, which is how the before/after screenshots below were captured.

Screenshots

Surface Before (baseline) After (this branch)
Newsletter settings screen (admin.php?page=jetpack#/newsletter) before after

JN rsync target: plugins/jetpack · Baseline: trunk (sync-current — the branch was identical to trunk at capture time) · JN site: thoughtfully-remarkable-device.jurassic.ninja · Pre/post renders are pixel-identical, as expected for Option A (direct library swap, no optimistic flip behavior change needed because disabled already blocks interaction during saves).

Testing instructions

Reproduce the old Newsletter settings UI by setting jetpack_wp_admin_newsletter_settings_enabled to false via a mu-plugin (add_filter( 'jetpack_wp_admin_newsletter_settings_enabled', '__return_false' );).

  • Visit Jetpack → Settings → Newsletter.

  • Verify the four sections render: Newsletter, Subscriptions (Homepage and posts / Navigation / Comments), Newsletter categories, and Email configuration (Email byline toggles, Featured image toggle).

  • Toggle each ToggleControl — the toggle should flip, save in the background, and the persisted state should match after the request resolves. The toggle is disabled during save (same as before).

  • Browser console is clean on mount and during toggling.

  • No visible margin regressions between sections.

  • Changelog entry added (plugins/jetpack, patch / other).

  • Visual diff reviewed — before/after are pixel-identical.

Swap ToggleControl imports from @automattic/jetpack-components to
@wordpress/components across the Newsletter settings screen. Drop the
unused 'toggling' prop (and pre-existing 'toogling' typo) since the
call sites already disable during save via the 'disabled' prop. Add
__nextHasNoMarginBottom to keep wp-admin margin behavior.

Part of #48160.
@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 18, 2026
@github-actions

github-actions Bot commented Apr 18, 2026 •

Copy link
Copy Markdown
Contributor

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 🤖


🔴 Action required: We would recommend that you add a section to the PR description to specify whether this PR includes any changes to data or privacy, like so:

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

My PR adds *x* and *y*.

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 commented Apr 18, 2026

Copy link
Copy Markdown
Contributor Author

Closing — this PR migrated the old Jetpack admin SPA Newsletter tab, but the intended target was the new dedicated Newsletter page (packages/newsletter), which already imports ToggleControl from @wordpress/components. No migration is needed on the new page; the old page was out of scope. Re-opening unnecessary.

@ilonagl ilonagl closed this Apr 18, 2026
@ilonagl
ilonagl deleted the issue-48160/migrate-newsletter-toggle branch April 18, 2026 21:14
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.

1 participant