Skip to content

Jetpack Search purchase flow: Allow 'enter' key form submission during purchase flow #104885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

anaemnesis
Copy link

@anaemnesis anaemnesis commented Jul 23, 2025

Proposed Changes

Addresses #54344

This PR enables the use of the Enter key to submit the form at /purchase-product/jetpack_search/monthly.

Note

Because components/suggestion-search/index.jsx is modified, this change also impacts any form that uses this component, meaning that Enter key submission would not be limited to only the form shown through the /purchase-product/jetpack_search/monthly flow. I looked into limiting the change to the one form, but if Enter key submission is a UX/QoL concern for the Jetpack Search purchase flow, then I would expect it to be a concern for similar flows elsewhere, and so we wouldn't want to limit this change.

Why are these changes being made?

This addresses a UX/QoL concern. As a user, I would expect to be able to press Enter twice when going through this purchase flow — once to select my site from the Site Search field and again to submit the form itself via the Get Search button. Right now, pressing Enter to select my site prevents Enter being used again to submit the form.

Testing Instructions

  • Ensure you're testing with an account that has a Jetpack-connected site, but no Search plan purchased.
  • Navigate to /purchase-product/jetpack_search/monthly and begin to type your site's URL
  • Press Enter to select the suggested site
  • Press Enter again to submit the Jetpack Search Get Search form
  • Upon pressing enter you should expect to be taken to the billing area to enter your purchase details
  • Try the same flow again using mouse clicks, and a combination of mouse clicks and enter key presses
  • Confirm no unexpected behaviour at the other paths impacted by this change:

    • /purchase-product/jetpack_search
    • /purchase-product/jetpack_search/monthly
    • /purchase-product/wpcom_search
    • /purchase-product/wpcom_search/monthly
  • Confirm Jetpack connection flow is not impacted, including:

    • /jetpack/connect/
    • /jetpack/connect/search

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)?

This PR addresses the UX issue raised in #54344 by making it possible to use the 'enter' key to
submit the form at `/purchase-product/jetpack_search/monthly`. Because `components/suggestion-search/index.jsx`
was modified, this change also impacts any form that uses this component, meaning that 'enter' key
submission would not be limited to only the `/purchase-product/jetpack_search/monthly` flow. Attempts to
limit the context of this change proved more involved than anticipated, and if 'enter' key submission is
a UX concern for the Jetpack Search purchase flow, then I would expect it to be a concern for similar flows
elsewhere and so limiting the change is probably not warranted.
Comment on lines -98 to -105
getSuggestionLabel( suggestionPosition ) {
return this.suggestionsRef.props.suggestions[ suggestionPosition ].label;
}

updateFieldFromSuggestion( newValue ) {
this.updateInputValue( newValue );
this.props.onChange( newValue, true );
}
Copy link
Author

Choose a reason for hiding this comment

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

These methods are unused.

@anaemnesis anaemnesis marked this pull request as ready for review July 23, 2025 17:06
@anaemnesis anaemnesis self-assigned this Jul 23, 2025
@anaemnesis anaemnesis added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Jul 23, 2025
@anaemnesis
Copy link
Author

@Automattic/red I'm not quite sure who to request for review on this. Would someone on the team have availability, or be able to suggest a better someone to reach out to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Purchase Product: pressing enter on the text input doesn't work on /purchase-product/jetpack_search/monthly
1 participant