-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Contact form: Fix problem when inserting phone number that begins with same digits as country code #54477
Conversation
When a user tries to input a phone number which starts with the same digits as the selected country's code, that initial part gets removed. This happens for example for Brazilian (international code +55) phone numbers: if I write 55 12345678 (55 being a valid city code), it gets truncated into 12345678. As reported in issue #25039, this happens for any phone number in the same situation.
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~17 bytes added 📈 [gzipped])
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 (~17 bytes added 📈 [gzipped])
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. Generated by performance advisor bot at iscalypsofastyet.com. |
This PR modifies the release build for wpcom-block-editor To test your changes on WordPress.com, run To deploy your changes after merging, see the documentation: PCYsg-l4k-p2 |
This PR modifies the release build for notifications To test your changes on WordPress.com, run To deploy your changes after merging, see the documentation: PCYsg-elI-p2 |
Link to Calypso live: https://calypso.live?image=registry.a8c.com/calypso/app:build-10054 |
This PR modifies the release build for editing-toolkit To test your changes on WordPress.com, run To deploy your changes after merging, see the documentation: PCYsg-mMA-p2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I've reviewed this and tested it every way I can think if. It seems to work great.
Thank you for this fix and for adding the tests! 🙇
Changes proposed in this Pull Request
The phone input field in the domain contact information form has had a problem for some time (issue #25039): when a user tries to input a phone number which begins with the same digits as the selected country's international dialing code, these numbers are removed from the input. Copy and pasting also doesn't work, the initial digits are removed the same.
For example, Brazil's dial code is +55, and a valid Brazilian phone number is 55 1234-5678, 55 being a national city code. This video shows what happens when you try to input that number by typing or pasting:
Kapture.2021-07-12.at.18.11.31.mp4
This PR fixes that behavior by updating the logic of when the international dialing prefix should be removed.
Testing instructions
This component has been tweaked several times (#41783, #37603, #24870, #10447 to cite a few), so please test it thoroughly. 🙇♂️
Unit tests should all be passing:
yarn run test-client client/components/phone-input/test
, but manual testing is also appreciated. The contact information form can be reached in the checkout page when buying a domain.Related to #25039