Skip to content
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

Signup form: use TextControl from @wordpress/components #99187

Merged
merged 3 commits into from
Feb 4, 2025

Conversation

ciampo
Copy link
Contributor

@ciampo ciampo commented Feb 1, 2025

Proposed Changes

  • Replace TextControl from client/components with TextControl from @wordpress/components in the signup form

Why are these changes being made?

  • Re-using existing WordPress UI components for better consistency and less first-party code to maintain

Testing Instructions

  • Log out
  • Visit http://calypso.localhost:3000/jetpack/connect/authorize?from=woocommerce-onboarding&_wp_nonce=foobar&blogname=Just%20Another%20WordPress.com%20Site&client_id=12345&close_window_after_login=0&close_window_after_auth=0&home_url=https://yourjetpack.blog&redirect_uri=https://yourjetpack.blog/wp-admin/admin.php&scope=administrator:34579bf2a3185a47d1b31aab30125d&secret=640fdbd69f96a8ca9e61&site=https://yourjetpack.blog&site_url=https://yourjetpack.blog&state=1&allow_site_connection=1&installed_ext_success=1&
  • Make sure that the form looks fine and works as expected
    • Focus/Hover/Active styles
    • Error validation
    • Disabled while submitting
    • Signup form works correctly

Notes:

  • The following instructions go though what's called "jetpack woo commerce flow". This form is also rendered in the so-called "jetpack woo DNA flow", although I wasn't able to find up to date testing instructions for this flow easily around the repo (PRs often lack testing instructions)
Before After
Screenshot 2025-02-01 at 14 49 44 Screenshot 2025-02-01 at 14 33 46

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

@ciampo ciampo added [Feature] Signup & Account Creation All screens and flows for making a new WordPress.com account. [Type] Janitorial labels Feb 1, 2025
@ciampo ciampo requested review from justinshreve, chihsuan, jeyip and a team February 1, 2025 13:54
@ciampo ciampo self-assigned this Feb 1, 2025
@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 1, 2025
@matticbot
Copy link
Contributor

matticbot commented Feb 1, 2025

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~162 bytes removed 📉 [gzipped])

name         parsed_size           gzip_size
entry-login       -411 B  (-0.0%)     -162 B  (-0.0%)
entry-main         +84 B  (+0.0%)      -31 B  (-0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~540 bytes removed 📉 [gzipped])

name                  parsed_size           gzip_size
accept-invite             +2138 B  (+1.2%)     +888 B  (+1.7%)
jetpack-connect            +840 B  (+0.1%)     +139 B  (+0.0%)
update-design-flow         +316 B  (+0.0%)       -8 B  (-0.0%)
signup                     +316 B  (+0.1%)       -8 B  (-0.0%)
link-in-bio-tld-flow       +316 B  (+0.0%)       -8 B  (-0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~715 bytes removed 📉 [gzipped])

name                          parsed_size           gzip_size
async-load-signup-steps-user      +2125 B  (+0.9%)     +921 B  (+1.3%)
async-load-design-blocks           -411 B  (-0.0%)     -131 B  (-0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@ciampo ciampo force-pushed the refactor/login-form-text-control-wordpress-components branch from 19b6b0c to 5fdd94e Compare February 1, 2025 14:17
Comment on lines -940 to -944
.logged-out-form input:focus {
border: 0;
box-shadow: none;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's fine to delete those changes because they are scoped under is-jetpack-woocommerce-flow or is-jetpack-woo-dna-flow, but I'd ask to the PR reviewers (especially the ones with more knowledge about all possible flows) to thoroughly check in case these styles are still necessary.

Copy link
Member

Choose a reason for hiding this comment

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

I sniffed around the code and figured out that you can add woodna_service_name=foo to the query params for the URL in your testing instructions to get this, which has the is-jetpack-woo-dna-flow class:

Woo DNA flow

Different screen, and doesn't have a logged-out-form class. Looks fine, including the focus state.

@ciampo ciampo mentioned this pull request Feb 1, 2025
8 tasks
Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

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

Works as expected, but may be cleaner with a flex gap?

Comment on lines -940 to -944
.logged-out-form input:focus {
border: 0;
box-shadow: none;
}

Copy link
Member

Choose a reason for hiding this comment

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

I sniffed around the code and figured out that you can add woodna_service_name=foo to the query params for the URL in your testing instructions to get this, which has the is-jetpack-woo-dna-flow class:

Woo DNA flow

Different screen, and doesn't have a logged-out-form class. Looks fine, including the focus state.

Comment on lines 811 to 815
// As we migrate more inputs to @wordpress/components' <TextControl />,
// we should extend this classname and realted styles for better coherency.
const inputClassName = 'signup-form__woo-input';
return (
<div>
Copy link
Member

Choose a reason for hiding this comment

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

I see you opted to keep CSS changes from the original to a minimum, but I think this would be a lot cleaner if we dropped the input-level class and instead spaced them all with a flex gap on the container div. With just a bit of top padding to compensate.

Copy link
Contributor Author

@ciampo ciampo Feb 4, 2025

Choose a reason for hiding this comment

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

Yeah, I was trying to keep changes to a minimum, although your suggestion makes sense!

Feedback addressed in 87fa8fd

Copy link
Member

@chihsuan chihsuan left a comment

Choose a reason for hiding this comment

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

LGTM and tested well! 👍

We've added a passwordless signup to the Woo DNA flow, so most users shouldn't see the signup form. The only way to see it is by using an account that needs to enter a password and then click on Create a new account.

Screen.Recording.2025-02-04.at.11.31.29.mov

This form is also rendered in the so-called "jetpack woo DNA flow", although I wasn't able to find up to date testing instructions for this flow easily around the repo (PRs often lack testing instructions)

You can test the Woo DNA flow by visiting the following path:

/jetpack/connect/authorize?client_id=239804800&redirect_uri=https%3A%2F%2Fcarp-of-turtles.jurassic.ninja%2Fwp-admin%2Fadmin.php%3Fhandler%3Djetpack-connection-webhooks%26action%3Dauthorize%26_wpnonce%3Dfa2483e781%26redirect%3Dhttps%253A%252F%252Fcarp-of-turtles.jurassic.ninja%252Fwp-admin%252Fadmin.php%253Fpage%253Dwc-settings%2526tab%253Dshipping%2526section%253Dwoocommerce-services-settings&state=1&scope=administrator%3A1234&user_email=user%40email.com&user_login=user&jp_version=14.2-a.1&secret=na&blogname=Carp+Of+Turtles&site_url=https%3A%2F%2Fcarp-of-turtles.jurassic.ninja&home_url=https%3A%2F%2Fcarp-of-turtles.jurassic.ninja&site_icon&site_lang=en_US&site_created=2024-12-11+04%3A19%3A54&allow_site_connection=1&calypso_env&source&_as=wp-cli&from=woocommerce-services&_ui=189375772&_ut=wpcom%3Auser_id&purchase_nonce=qUjMAC7v&woodna_service_name=WooCommerce+Shipping+%26+Tax&woodna_help_url=https%3A%2F%2Fwoocommerce.com%2Fdocument%2Fwoocommerce-shipping-and-tax%2F&_wp_nonce=1e563eb72b&redirect_after_auth=https%3A%2F%2Fcarp-of-turtles.jurassic.ninja%2Fwp-admin%2Fadmin.php%3Fpage%3Dwc-settings%26tab%3Dshipping%26section%3Dwoocommerce-services-settings&site=https%3A%2F%2Fcarp-of-turtles.jurassic.ninja

@ciampo ciampo force-pushed the refactor/login-form-text-control-wordpress-components branch from 5fdd94e to 328aab3 Compare February 4, 2025 11:15
Comment on lines -291 to -324
.signup-form__woocommerce-wrapper {
text-align: center;
border-bottom: 1px solid var(--color-neutral-50);
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 56px;

svg > g {
transform: translateX(50%);
}
}

.signup-form__woocommerce-logo {
margin: 0;
text-align: center;
margin-right: auto;
margin-left: auto;
padding-left: 0;
display: block;
height: 56px;
border-bottom: 1px solid var(--color-woocommerce-header-border);
background: var(--color-text-inverted);

svg {
margin-top: 15px;
}
}

.signup-form__woocommerce-heading {
margin-top: 32px;
}

Copy link
Contributor Author

@ciampo ciampo Feb 4, 2025

Choose a reason for hiding this comment

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

While working on addressing the PR's feedback, I noticed that these styles are associated with classnames that don't seem to be used anymore across the codebase (I was able to trace the classnames being removed from the DOM in #65480)

Copy link
Member

Choose a reason for hiding this comment

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

Always nice to see some red!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wait until you see #99189 :D

@ciampo ciampo merged commit 29c56f2 into trunk Feb 4, 2025
13 checks passed
@ciampo ciampo deleted the refactor/login-form-text-control-wordpress-components branch February 4, 2025 12:47
@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 4, 2025
Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

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

Great cleanup 🚀

Comment on lines -291 to -324
.signup-form__woocommerce-wrapper {
text-align: center;
border-bottom: 1px solid var(--color-neutral-50);
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 56px;

svg > g {
transform: translateX(50%);
}
}

.signup-form__woocommerce-logo {
margin: 0;
text-align: center;
margin-right: auto;
margin-left: auto;
padding-left: 0;
display: block;
height: 56px;
border-bottom: 1px solid var(--color-woocommerce-header-border);
background: var(--color-text-inverted);

svg {
margin-top: 15px;
}
}

.signup-form__woocommerce-heading {
margin-top: 32px;
}

Copy link
Member

Choose a reason for hiding this comment

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

Always nice to see some red!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Signup & Account Creation All screens and flows for making a new WordPress.com account. [Type] Janitorial
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants