Skip to content

Conversation

@ashfame
Copy link
Member

@ashfame ashfame commented Feb 11, 2026

When navigating from the playground step to the domains step in the onboarding flow, the back button incorrectly showed "Back to sites" instead of allowing the user to return to the playground.

The original playground commit (999290b) fixed this in the legacy domains step, but the fix was lost during the Domain Search Rewrite (f219972). The rewritten step uses a back_to query parameter to control the back button, but the playground-to-domains navigation never set it.

Pass the current playground URL as back_to when navigating to the domains step so the existing back button logic picks it up correctly.

Fixes https://linear.app/a8c/issue/ARC-1458/back-button-from-domains-step-links-to-mywordpresscomsites

Proposed Changes

Why are these changes being made?

Testing Instructions

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you tested accessibility for your changes? Ensure the feature remains usable with various user agents (e.g., browsers), interfaces (e.g., keyboard navigation), and assistive technologies (e.g., screen readers) (PCYsg-S3g-p2).
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@ashfame ashfame requested a review from zaerl February 11, 2026 18:16
@ashfame ashfame self-assigned this Feb 11, 2026
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 11, 2026
@matticbot
Copy link
Contributor

matticbot commented Feb 11, 2026

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • help-center
  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug fix_back_link_pg_flow on your sandbox.

case 'playground':
return navigate( 'domains' );
case 'playground': {
const backTo = window.location.pathname + window.location.search;
Copy link
Contributor

Choose a reason for hiding this comment

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

I checked the code, and unfortunately, the domains step has a custom back button that doesn't rely on automatic history. So this is the best approach.

The only change I suggest is to use React useLocation() hook, which is mockable in tests. Feel free to use it or land this PR as is.

Great work, as always 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried and it breaks. Pls see my revert commit's message. Going to merge as is.

@ashfame ashfame force-pushed the fix_back_link_pg_flow branch 2 times, most recently from 2fe2a4d to bb4e51d Compare February 12, 2026 12:03
When navigating from the playground step to the domains step in the
onboarding flow, the back button incorrectly showed "Back to sites"
instead of allowing the user to return to the playground.

The original playground commit (999290b) fixed this in the legacy
domains step, but the fix was lost during the Domain Search Rewrite
(f219972). The rewritten step uses a `back_to` query parameter
to control the back button, but the playground-to-domains navigation
never set it.

Pass the current playground URL as `back_to` when navigating to the
domains step so the existing back button logic picks it up correctly.
…testing"

This reverts commit df46a61.

useLocation() from react-router returns paths relative to the router
basename ("setup"), so it gives /onboarding/playground instead of
/setup/onboarding/playground. Since back_to is used as an href on
<Step.BackButton>, it needs the full browser path. Hence, reverted to
window.location which provides the correct absolute path.
@ashfame ashfame force-pushed the fix_back_link_pg_flow branch from bb4e51d to ef551a0 Compare February 12, 2026 12:21
@ashfame ashfame enabled auto-merge (squash) February 12, 2026 12:22
@ashfame ashfame merged commit 83f86ac into trunk Feb 12, 2026
9 of 12 checks passed
@ashfame ashfame deleted the fix_back_link_pg_flow branch February 12, 2026 12:30
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants