Writing Settings: Import ToggleControl from @wordpress/components#48186
Writing Settings: Import ToggleControl from @wordpress/components#48186
Conversation
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.
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
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:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 1 file.
|
The wrapper silently dropped the prop too — upstream @wordpress/components ToggleControl has no disabledReason. Remove the dead helper vars that computed those reasons.
simison
left a comment
There was a problem hiding this comment.
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.
Refs #48160
Proposed changes
ToggleControldirectly from@wordpress/componentsin the Jetpack plugin Writing settings page (writing-media.jsx,custom-content-types.jsx) instead of the@automattic/jetpack-componentsre-export.toggling={}prop (accepting a minor in-flight UX loss —disabledguards still prevent double-submit).__nextHasNoMarginBottom={ true }on every call site to silence the deprecation warning. Margin behavior is unchanged — the wrapper already passed this flag internally.disabledReasonprop on the testimonial/portfolio toggles and the dead helper vars that computed those strings. The wrapper was silently droppingdisabledReasontoo (it's not in the wrapper's destructured props), so this is a no-op for current users.@automattic/jetpack-componentsconsumer migration tracked in #48160. Follows the same pattern used for the Security settings in #48179.Out of scope:
ModuleToggleusages (still route through_inc/client/components/module-toggle, which imports from@automattic/jetpack-components). Follow-up.ToggleControlwrapper atprojects/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#/writingat 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-componentswrapper re-exported the same@wordpress/componentsToggleControlwith__nextHasNoMarginBottom={ true }as a default, so the at-rest visual output matches. The behavioral difference (no mid-save opacity viatoggling) only shows during an active save and is not captured here.JN rsync target:
plugins/jetpack· Baseline:trunk· JN site:thoughtfully-remarkable-device.jurassic.ninjaNote: the Testimonials / Portfolios toggles in
custom-content-types.jsxare also migrated here but aren't shown above because the JN site is on a block theme (twentytwentyfour) andJetpack_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
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).__nextHasNoMarginBottomdeprecation 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).