Skip to content

Connection: Component updates - replace Modal with Dialog#50735

Open
coder-karen wants to merge 18 commits into
trunkfrom
update/connection-js-package-modal-to-dialog
Open

Connection: Component updates - replace Modal with Dialog#50735
coder-karen wants to merge 18 commits into
trunkfrom
update/connection-js-package-modal-to-dialog

Conversation

@coder-karen

@coder-karen coder-karen commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Fixes CONNECT-390

Proposed changes

  • This PR creates a new shared ConnectionDialog component, which makes of use of @wordpress/ui's Dialog component, replacing the Modal that was in place.
  • This share component is now in use in disconnect-dialog/index.tsx , manage-connection-dialog/index.tsx, and owner-disconnect-dialog/index.tsx.
  • Styling has been updated to match previous styling as best as possible.
  • Additionally, the Owner Disconnect Dialog now makes use of a Text component from @wordpress/ui as well (for heading./ sub-heading), in line with it's sibling components.
  • Step files have also been updated to make use of a shared ConnectionDialogTitle to help prevent an accessibility issue. The accessible name tracks the step — eg. success screen now announces "successfully disconnected", not the stale question.
  • The Jetpack plugin Owner Disconnect Dialog relied on styles from the package despite being it's own component, so old styles are transferred across to the plugin for now to make sure that still looks as before (updating the Jetpack components will come in a later task).

Additionally:

  • New Dialog component (from @wordpress/ui) pulls in @wordpress/theme and @wordpress/private-apis under the hood. Older WP core (eg. 6.9) doesn't always ship those, so script fails to load. The fix here was to polyfill them via wp-build-polyfills, only registered when core's version is missing/incomplete — so most sites load nothing extra, and old sites get just the two small polyfills instead of Webpack bundling duplicate copies into every site's JS regardless of need.
  • Additionally, the polyfill registrar dropped any handles/modules requested after the first consumer triggered registration. This PR's new connection consumer exposed that by registering before Social, causing Social's @wordpress/boot module to be dropped on WP < 7.0. Fix: register on every call, guarded only against duplicate hooks.
  • Protect + Search e2e (package.json) — separate issue. These plugins' e2e builds have a hardcoded project list that was missing wp-build-polyfills, so the polyfill's JavaScript was never built into their test environments. The PHP asked to register the polyfill, but the files weren't there, so jetpack-connection.js got dropped again. Adding packages/wp-build-polyfills to their build scripts fixes it. (Jetpack/Boost/Social already had it).

Related product discussion/links

  • See linked issue above.

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

No.

Testing instructions

On a Jetpack-connected site with this PR applied (locally or using the Jetpack Beta tester plugin):

  • To test, click on the connection link on the My Jetpack page on the bottom right (eg 'Site and account connected'). This should look the same as before. .
  • Click on Disconnect Jetpack and the disconnect dialog should look as it did before as well.
  • If you click on 'Stay connected' you'll return to the main 'Manage Connection dialog', and can click on 'Disconnect my user account' to view the owner disconnect dialog, which should also look as before.
  • Test on mobile screens, this should generally look similar to before, some slight differences.
  • To test the disconnect survey, disconnect your user account via the My Jetpack page. Make sure it looks and behaves as before, including the 'Submit Feedback' button.
    • You may need to trigger the survey - I resorted to adding setIsProvidingFeedback( true ); within handleDisconnect in DisconnectDialog to get this to work, so testing locally and re-building for those changes (rebuild My Jetpack and dependencies) is what worked for me.

To test that the Jetpack plugin OwnerDisconnectDialog component styles still look as expected:

  • Visit the Jetpack dashboard settings page at /wp-admin/admin.php?page=jetpack#/settings.
  • You'll need siteConnectionMode to be returning true here: (if testing locally, set this to true and rebuild Jetpack (plus dependencies)).
  • In the search field, add a search for port.
  • Scroll down, and see the Connect your WordPress.com account links in several cards (eg Forms). Click on this.
  • The display and behavior should match what you see on trunk.

Additionally, to confirm the Webpack bundling change, with WordPress 6.9 installed (can use a rollback plugin):

  • On WP 6.9: load Social, Protect, Search, and Jetpack dashboards — each must render with no console errors, and the disconnect/manage/owner-disconnect dialogs must open and dismiss (Escape + backdrop). Repeat on WP latest to confirm no regression.

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

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 or WordPress.com Site Helper), and enable the update/connection-js-package-modal-to-dialog branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/connection-js-package-modal-to-dialog
bin/jetpack-downloader test jetpack-mu-wpcom-plugin update/connection-js-package-modal-to-dialog

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/ [Tests] Includes Tests Admin Page React-powered dashboard under the Jetpack menu RNA labels Jul 22, 2026
@github-actions

github-actions Bot commented Jul 22, 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 🤖


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:

No scheduled milestone found for this plugin.

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


Backup plugin:

No scheduled milestone found for this plugin.

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


Boost plugin:

No scheduled milestone found for this plugin.

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


Search plugin:

No scheduled milestone found for this plugin.

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


Social plugin:

No scheduled milestone found for this plugin.

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


Starter Plugin plugin:

No scheduled milestone found for this plugin.

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


Protect plugin:

No scheduled milestone found for this plugin.

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


Videopress plugin:

No scheduled milestone found for this plugin.

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


Mu Wpcom plugin:

  • Next scheduled release: WordPress.com Simple releases happen semi-continuously (PCYsg-Jjm-p2)

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


Inspect plugin:

No scheduled milestone found for this plugin.

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


Wpcomsh plugin:

  • Next scheduled release: Atomic deploys happen twice daily on weekdays (p9o2xV-2EN-p2)

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


Automattic For agencies client plugin:

No scheduled milestone found for this plugin.

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


Classic Theme helper plugin plugin:

No scheduled milestone found for this plugin.

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


Paypal Payment buttons plugin:

No scheduled milestone found for this plugin.

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


Wpcloud Sso plugin:

No scheduled milestone found for this plugin.

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


Premium Analytics plugin:

No scheduled milestone found for this plugin.

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


Agents Manager plugin:

No scheduled milestone found for this plugin.

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

@jp-launch-control

jp-launch-control Bot commented Jul 22, 2026

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/js-packages/connection/components/manage-connection-dialog/index.tsx 41/45 (91.11%) -6.67% 3 ❤️‍🩹
projects/packages/connection/src/class-connection-assets.php 0/13 (0.00%) 0.00% 2 ❤️‍🩹
projects/packages/wp-build-polyfills/src/class-wp-build-polyfills.php 94/99 (94.95%) 4.04% -4 💚

1 file is newly checked for coverage.

File Coverage
projects/js-packages/connection/components/shared/connection-dialog/index.tsx 13/14 (92.86%) 💚

Full summary · PHP report · JS report

@coder-karen
coder-karen marked this pull request as ready for review July 22, 2026 16:05
@coder-karen
coder-karen requested a review from Copilot July 22, 2026 16:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the Connection UI dialogs in the projects/js-packages/connection package from @wordpress/components Modal to @wordpress/ui Dialog by introducing shared dialog scaffolding and updating the existing disconnect/manage/owner-disconnect flows. It also prevents the Jetpack plugin’s Owner Disconnect Dialog from inheriting connection package dialog styles by namespacing its styles to the plugin.

Changes:

  • Added a shared ConnectionDialog + ConnectionDialogTitle wrapper around @wordpress/ui Dialog to standardize dismissal and accessible naming.
  • Updated Connection package dialogs, steps, styles, and tests to use the new shared dialog/title.
  • Updated Jetpack plugin Owner Disconnect Dialog to use its own namespaced classes/styles and adjusted ARIA labelling.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
projects/plugins/jetpack/changelog/update-connection-js-package-ui-pt5 Changelog entry for plugin-side style namespacing.
projects/plugins/jetpack/_inc/client/components/owner-disconnect-dialog/style.scss Adds namespaced, self-contained styles for the plugin’s owner disconnect dialog.
projects/plugins/jetpack/_inc/client/components/owner-disconnect-dialog/index.jsx Switches plugin dialog classnames/labelledby to the new namespaced selectors/IDs.
projects/js-packages/connection/components/shared/connection-dialog/index.tsx Introduces shared ConnectionDialog wrapper and ConnectionDialogTitle for accessible naming.
projects/js-packages/connection/components/owner-disconnect-dialog/test/component.tsx Updates tests to validate dialog accessible naming and heading semantics.
projects/js-packages/connection/components/owner-disconnect-dialog/style.scss Removes styles that were specific to the old Modal/button styling and relies on shared disconnect styles.
projects/js-packages/connection/components/owner-disconnect-dialog/index.tsx Migrates owner disconnect to ConnectionDialog and uses ConnectionDialogTitle + Text.
projects/js-packages/connection/components/manage-connection-dialog/test/component.tsx Updates wording and continues asserting dialog accessibility behavior.
projects/js-packages/connection/components/manage-connection-dialog/style.scss Adjusts layout/styling to work with the Dialog popup sizing/scrolling behavior.
projects/js-packages/connection/components/manage-connection-dialog/index.tsx Migrates manage connection dialog to ConnectionDialog and ConnectionDialogTitle.
projects/js-packages/connection/components/disconnect-dialog/test/step-thank-you.tsx Wraps isolated step test in a minimal Dialog context for Dialog.Title.
projects/js-packages/connection/components/disconnect-dialog/test/step-disconnect.tsx Same as above for the disconnect step.
projects/js-packages/connection/components/disconnect-dialog/test/step-disconnect-confirm.tsx Same as above for the confirm step.
projects/js-packages/connection/components/disconnect-dialog/test/component.tsx Updates tests to assert dialog + heading semantics with step-driven accessible naming.
projects/js-packages/connection/components/disconnect-dialog/style.scss Updates dialog layout/typography/styles for the new Dialog-based structure.
projects/js-packages/connection/components/disconnect-dialog/steps/step-thank-you.tsx Switches the step heading to ConnectionDialogTitle for correct accessible naming.
projects/js-packages/connection/components/disconnect-dialog/steps/step-survey.tsx Switches the step heading to ConnectionDialogTitle.
projects/js-packages/connection/components/disconnect-dialog/steps/step-disconnect.tsx Switches the step heading to ConnectionDialogTitle.
projects/js-packages/connection/components/disconnect-dialog/steps/step-disconnect-confirm.tsx Switches the step heading to ConnectionDialogTitle.
projects/js-packages/connection/components/disconnect-dialog/index.tsx Migrates disconnect dialog to ConnectionDialog.
projects/js-packages/connection/changelog/update-connection-js-package-ui-pt5 Changelog entry for the Dialog migration in the Connection package.

Comment thread projects/js-packages/connection/changelog/update-connection-js-package-ui-pt5 Outdated
Comment thread projects/plugins/jetpack/changelog/update-connection-js-package-ui-pt5 Outdated
bindlegirl
bindlegirl previously approved these changes Jul 23, 2026

@bindlegirl bindlegirl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 👍 I tested on self-hosted and WoW.

While testing I did notice one thing that I'm not sure if it's deliberate or not. The Esc works on Disconnect account dialog but not the first one (Disconnect site). It's not a new behavior. I just noticed it now. I'll let you decide if it's worth aligning these two or not 🙂

@coder-karen

Copy link
Copy Markdown
Contributor Author

Thanks for the review!

Are you referring to the Manage Connection Dialog (the first dialog that appears when clicking 'Site and account connected' from My Jetpack?). The dialogs that open from the two options within are both esc closable, so there is consistency based on the type of dialog as I saw it.

But I dug more based on your comment. There was a deliberate decision to only focus on those Disconnect modals here - #27643. But the reasoning for leaving the Manage Connection Dialog isn't clear. There was a risk with including it there - if there were an in-flight unlink request. But this can be covered by a ! isControlsDisabled gate.

So I opted to add this in. Tested a few flows, and everything looks ok to me.

bindlegirl
bindlegirl previously approved these changes Jul 24, 2026

@bindlegirl bindlegirl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for adding that fix. Tested it again and it all looks good.

@coder-karen
coder-karen removed request for a team July 24, 2026 13:08
@github-actions github-actions Bot added [Plugin] Agents Manager [Plugin] Automattic For Agencies Client [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Classic Theme Helper Plugin [Plugin] Inspect [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Paypal Payment Buttons [Plugin] Premium Analytics [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. [Plugin] Social Issues about the Jetpack Social plugin [Plugin] Starter Plugin [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. [Plugin] Wpcloud Sso [Plugin] Wpcomsh labels Jul 24, 2026
@coder-karen coder-karen added [Status] In Progress and removed [Status] Needs Review This PR is ready for review. labels Jul 24, 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 E2E Tests [JS Package] Connection [Package] Connection [Package] Wp Build Polyfills [Plugin] Agents Manager [Plugin] Automattic For Agencies Client [Plugin] Backup A plugin that allows users to save every change and get back online quickly with one-click restores. [Plugin] Boost A feature to speed up the site and improve performance. [Plugin] Classic Theme Helper Plugin [Plugin] Inspect [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] mu wpcom jetpack-mu-wpcom plugin [Plugin] Paypal Payment Buttons [Plugin] Premium Analytics [Plugin] Protect A plugin with features to protect a site: brute force protection, security scanning, and a WAF. [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. [Plugin] Social Issues about the Jetpack Social plugin [Plugin] Starter Plugin [Plugin] VideoPress A standalone plugin to add high-quality VideoPress videos to your site. [Plugin] Wpcloud Sso [Plugin] Wpcomsh RNA [Status] In Progress [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants