Skip to content

Traffic Settings: Import ToggleControl from @wordpress/components#48189

Merged
simison merged 1 commit intotrunkfrom
traffic/toggle-control-wp-components
Apr 19, 2026
Merged

Traffic Settings: Import ToggleControl from @wordpress/components#48189
simison merged 1 commit intotrunkfrom
traffic/toggle-control-wp-components

Conversation

@ilonagl
Copy link
Copy Markdown
Contributor

@ilonagl ilonagl commented Apr 19, 2026

Fixes #48160 (partial — one box on the tracking issue).

Proposed changes

  • Migrate the ToggleControl usages on the Jetpack Traffic settings page (Site Stats, Related Posts, Google Analytics, Blaze, SEO) off the @automattic/jetpack-components wrapper and onto @wordpress/components directly.
  • Add __nextHasNoMarginBottom={ true } on every call site so margin matches what the wrapper was setting by default and no deprecation warning fires.
  • Drop the wrapper's toggling prop (not present on the upstream component). Existing disabled guards keep repeat submissions from firing while settings are in flight; the only user-visible loss is the short optimistic-flip / dim effect during the save round-trip.

The @automattic/jetpack-components wrapper and its other consumers (including the ModuleToggle wrapper used elsewhere on the same page) are intentionally left alone — separate follow-up.

Same shape as #48179 (Security Settings).

The 5 files touched have 12 direct ToggleControl call sites in total:

  • blaze.jsx (2 — disabled fallback toggles)
  • google-analytics.jsx (2)
  • related-posts.jsx (2)
  • seo.jsx (1 — AI SEO enhancer)
  • site-stats.jsx (5)

Related product discussion/links

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

No. This is a UI-layer refactor: only the import source of ToggleControl and its rendered __nextHasNoMarginBottom / toggling props change. No telemetry, option storage, REST surface, or user data flow is modified.

Screenshots

Surface Before (baseline on JN) After (this branch on JN)
Traffic settings (full page, foldables collapsed) before after

The two PNGs are byte-for-byte identical (CRC32 0x868c8034 for both, captured via html2canvas against the same DOM after the trunk-equivalent and post-migration rsyncs respectively). That confirms the migration produces zero rendered-pixel change at rest — expected, because the wrapper was already passing __nextHasNoMarginBottom={ true } through to the upstream component, and the only visible difference (toggling dim) only appears during an in-flight save.

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

Testing instructions

  • On a connected Jetpack site, visit Jetpack → Settings → Traffic.

  • Toggle each of the following and confirm they save and persist (no console errors):

    • Related Posts: Highlight related content with a heading, Show a thumbnail image where available
    • SEO (when AI SEO enhancer is available): Automatically generate SEO title…
    • Site Stats foldable → Include a small chart in your admin bar…, Count logged in page views from rows, Allow Jetpack Stats to be viewed by rows, Show post views for this site.
  • Verify the deprecation warning about __nextHasNoMarginBottom no longer fires for these toggles.

  • Confirm the ModuleToggle-driven toggles (e.g. Show related content after posts, Customize your SEO settings, Add canonical URLs to archive pages, the Blaze module switch) and their in-flight dim effect still work as before — they're untouched by this PR.

  • Changelog entry added

  • Visual diff reviewed (both PNGs are byte-identical)

Migrate the `ToggleControl` usages on the Jetpack Traffic settings page
(Site Stats, Related Posts, Google Analytics, Blaze, SEO) off the
`@automattic/jetpack-components` wrapper and onto `@wordpress/components`
directly.

- Add `__nextHasNoMarginBottom` on every call site so margin matches
  what the wrapper was setting by default and no deprecation warning
  fires.
- Drop the wrapper's `toggling` prop (not present on the upstream
  component). Existing `disabled` guards keep repeat submissions from
  firing while settings are in flight; the only user-visible loss is
  the short optimistic-flip / dim effect during the save round-trip.

The `@automattic/jetpack-components` wrapper and its other consumers
(including the ModuleToggle wrapper used elsewhere on the same
page) are intentionally left alone — separate follow-up.

Part of #48160.
@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 traffic/toggle-control-wp-components branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack traffic/toggle-control-wp-components

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 marked this pull request as ready for review April 19, 2026 16:53
@ilonagl ilonagl self-assigned this Apr 19, 2026
@jp-launch-control
Copy link
Copy Markdown

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report · JS report

@ilonagl ilonagl requested review from dhasilva and simison April 19, 2026 17:06
@ilonagl ilonagl added the [Status] Needs Review This PR is ready for review. label Apr 19, 2026
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Apr 19, 2026
@ilonagl ilonagl 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
@ilonagl ilonagl added [Status] In Progress 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
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!

@simison simison merged commit b9a0ef9 into trunk Apr 19, 2026
84 checks passed
@simison simison deleted the traffic/toggle-control-wp-components branch April 19, 2026 20:29
@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.

Jetpack UI Modernization

2 participants