Premium Analytics: keep the onboarding welcome modal open on a click outside - #52095
Conversation
…outside A click on the backdrop dismissed the welcome modal, and since the onboarding opens once per reader that stray click lost the tour for good. Base UI's disablePointerDismissal keeps the modal up; the close button and Escape still dismiss it. Fixes UNI-750. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E6EnRKyZ6hzCb2pm7Y4tXN
|
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. 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. |
Code Coverage SummaryThis 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. 🤷 |
layoutd
left a comment
There was a problem hiding this comment.
Verified manually following test instructions: clicking outside the modal no longer closes it, Escape and the close button still do, and the tour handoff is unchanged. The new test fails against trunk and passes here. One small DRY inline, not blocking.
|
|
||
| /** How the reader closed the journey without finishing it. */ | ||
| export type OnboardingDismissReason = 'close' | 'escape' | 'outside' | 'other'; | ||
| export type OnboardingDismissReason = 'close' | 'escape' | 'other'; |
There was a problem hiding this comment.
This union is a copy of the one in packages/ui/src/onboarding-welcome-modal/onboarding-welcome-modal.tsx:8, which meant eaditing both to make changes here.
The ui package already exports OnboardingDismissReason (packages/ui/src/index.ts:16) and stage.tsx already imports from @jetpack-premium-analytics/ui, so maybe the hook can import the type and drop its copy.
There was a problem hiding this comment.
Good call, thanks. Done in b28ccc3: the hook now imports OnboardingDismissReason from @jetpack-premium-analytics/ui and re-exports it, so hooks/index.ts and the stage keep working unchanged and there is a single definition again.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E6EnRKyZ6hzCb2pm7Y4tXN
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E6EnRKyZ6hzCb2pm7Y4tXN
Fixes UNI-750
Proposed changes
outsidefrom the onboarding dismiss reasons, since the modal can no longer produce it.Why
The onboarding opens once per reader per site, and the preference is written the moment it opens. A stray click on the backdrop therefore dismissed the modal for good, with no way back to the tour. Base UI's
disablePointerDismissalonDialog.Rootkeeps the backdrop click from closing it; the keyboard and the close button behave as before.Related product discussion/links
Does this pull request change what data or activity we track or use?
No new data. The
reasonproperty onjetpack_premium_analytics_onboarding_dismisscan no longer beoutside;close,escapeandotherare unchanged.Testing instructions
Open the new Traffic tab (Jetpack → Stats → Traffic, or the standalone Premium Analytics plugin) on a site where the onboarding has not run yet. To run it again on a site where it has, reset the preference in the browser console and reload:
With the welcome modal open, click on the dimmed backdrop outside it.
Press Escape, or click the close button: the modal closes, as before.
Reopen (reset the preference again) and click Take a quick tour: the tour starts, as before.
pnpm jetpack test js packages/premium-analyticspasses; the new test covers the click outside.🤖 Generated with Claude Code
https://claude.ai/code/session_01E6EnRKyZ6hzCb2pm7Y4tXN