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

Confirm email - use pattern validation #6751

Merged
merged 12 commits into from
Feb 3, 2025
Merged

Conversation

andrewHEguardian
Copy link
Contributor

@andrewHEguardian andrewHEguardian commented Jan 31, 2025

What are you doing in this PR?

Implement the confirm email field but using HTML form validation - a pattern regex field that updates based on whatever is in the email field.

This PR also enables it as an A/B test

Trello Card

Why are you doing this?

This is a branch off of #6742 but using a different mechanism.

Comparison of this approach (HTML validation) vs the other approach (validate in JS)

Pros:

  • Fits with our other validation of the form
  • Doesn't require a check based on the sign-in status in the form's submit function

Cons:

  • Adds an additional dependency (we wanted to use RegExp.escape but it has limited availability)
  • Slightly clunky useRef

How to test

See #6742

Copy link
Contributor

github-actions bot commented Jan 31, 2025

Size Change: +624 B (+0.03%)

Total Size: 1.89 MB

ℹ️ View Unchanged
Filename Size Change
./public/compiled-assets/javascripts/[countryGroupId]/events/router.js 90.3 kB +37 B (+0.04%)
./public/compiled-assets/javascripts/[countryGroupId]/router.js 93.4 kB +33 B (+0.04%)
./public/compiled-assets/javascripts/ausMomentMap.js 108 kB 0 B
./public/compiled-assets/javascripts/contributionsRedirectStyles.js 20 B 0 B
./public/compiled-assets/javascripts/digitalSubscriptionLandingPage.js 222 kB +39 B (+0.02%)
./public/compiled-assets/javascripts/downForMaintenancePage.js 67.3 kB 0 B
./public/compiled-assets/javascripts/error404Page.js 67.3 kB 0 B
./public/compiled-assets/javascripts/error500Page.js 67.2 kB +1 B (0%)
./public/compiled-assets/javascripts/favicons.js 617 B 0 B
./public/compiled-assets/javascripts/paperSubscriptionCheckoutPage.js 163 kB +32 B (+0.02%)
./public/compiled-assets/javascripts/paperSubscriptionLandingPage.js 87.6 kB +32 B (+0.04%)
./public/compiled-assets/javascripts/payPalErrorPage.js 65.9 kB +1 B (0%)
./public/compiled-assets/javascripts/payPalErrorPageStyles.js 20 B 0 B
./public/compiled-assets/javascripts/promotionTerms.js 73.5 kB +37 B (+0.05%)
./public/compiled-assets/javascripts/subscriptionsLandingPage.js 72.9 kB +35 B (+0.05%)
./public/compiled-assets/javascripts/subscriptionsRedemptionPage.js 118 kB +39 B (+0.03%)
./public/compiled-assets/javascripts/unsupportedBrowserStyles.js 20 B 0 B
./public/compiled-assets/javascripts/weeklySubscriptionCheckoutPage.js 160 kB +36 B (+0.02%)
./public/compiled-assets/javascripts/weeklySubscriptionLandingPage.js 88.2 kB +36 B (+0.04%)
./public/compiled-assets/webpack/114.js 12.2 kB 0 B
./public/compiled-assets/webpack/127.js 3.53 kB 0 B
./public/compiled-assets/webpack/136.js 2.17 kB 0 B
./public/compiled-assets/webpack/163.js 8.9 kB 0 B
./public/compiled-assets/webpack/187.js 20 kB +34 B (+0.17%)
./public/compiled-assets/webpack/192.js 5.69 kB 0 B
./public/compiled-assets/webpack/276.js 4.39 kB 0 B
./public/compiled-assets/webpack/344.js 2 kB 0 B
./public/compiled-assets/webpack/445.js 6.87 kB 0 B
./public/compiled-assets/webpack/492.js 7.58 kB 0 B
./public/compiled-assets/webpack/706.js 107 kB 0 B
./public/compiled-assets/webpack/719.js 13.5 kB 0 B
./public/compiled-assets/webpack/847.js 26 kB 0 B
./public/compiled-assets/webpack/969.js 37.8 kB 0 B
./public/compiled-assets/webpack/checkout.js 17.2 kB +232 B (+1.37%)
./public/compiled-assets/webpack/GuardianAdLiteLanding.js 8.27 kB 0 B
./public/compiled-assets/webpack/LandingPage.js 15.5 kB 0 B
./public/compiled-assets/webpack/oneTimeCheckout.js 6.07 kB 0 B
./public/compiled-assets/webpack/ThankYou.js 44.4 kB 0 B

compressed-size-action

@@ -66,6 +77,42 @@ export function PersonalDetailsFields({
}}
/>
</div>
{requireConfirmedEmail && !isEmailAddressReadOnly && (
<div ref={confirmEmailRef}>
Copy link
Contributor Author

@andrewHEguardian andrewHEguardian Jan 31, 2025

Choose a reason for hiding this comment

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

We can't put the ref on the source component, see this discussion

Copy link
Contributor

@GHaberis GHaberis left a comment

Choose a reason for hiding this comment

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

I think this is the neater of the options, as it aligns with our other validation on the form 👍

@andrewHEguardian andrewHEguardian merged commit a214d2d into main Feb 3, 2025
19 checks passed
@andrewHEguardian andrewHEguardian deleted the confirm-email-pattern branch February 3, 2025 09:38
@prout-bot
Copy link

Seen on PROD (merged by @andrewHEguardian 9 minutes and 56 seconds ago)

Sentry Release: support-client-side, support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants