-
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
Domain Contact Form: Implement New Phone Input AB Test #10447
Conversation
onChange={ this.handlePhoneChange } | ||
{ ...omit( this.getFieldProps( 'phone' ), 'onChange' ) } /> | ||
); | ||
} else { |
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.
You should just return
here, without the else
branch (it causes an eslint warning 🤷♂️).
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.
Fixed this but honestly, it makes the code harder to read with a conditional return. I think we should change the linter to allow if-else with only one if block.
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.
If the return
line is long like here - I agree, it's not really helping with readability. But with simpler return values it's usually helpful.
f57161e
to
0e54743
Compare
@@ -132,7 +158,7 @@ export default React.createClass( { | |||
name, | |||
ref: name, | |||
additionalClasses: 'checkout-field', | |||
value: formState.getFieldValue( this.state.form, name ), | |||
value: formState.getFieldValue( this.state.form, name ) || '', |
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.
Is this change required by the new field? Maybe it should be fixed there (so that it properly returns an empty string when no value is input), instead of here?
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.
I prefer to ensure data is in the correct format as early as possible. There's no point in passing null
to a text field and it'll force the field to have null checks or default values.
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.
Fair enough - I was thinking about primitive/native fields here, but more complex components might indeed need additional logic to handle such cases correctly 👍
9aab8fb
to
6f99a26
Compare
Gonna fix this in another PR, I'm going to remove the dependency of FormCountrySelection. It shouldn't have any side effects to keep it this way though.
I can't really reproduce this, we only switch focus if you click submit. Can you give more instructions to reproduce?
Yep, It's unrelated and it's caused due to wrapping components with
Added Kosovo's dial code manually, there a few uninhabited countries we are allowing, I'm removing them at D3984-code.
That on its own shouldn't cause a problem, I think. We don't require country code so it makes sense to suppress the message. |
ab1211e
to
8214d46
Compare
I could reliably reproduce that on Chromium 51. After updating to 57, it works correctly. Can't reproduce it in Safari either, so I'd consider this a bug in Chromium. As for everything else - sounds/looks good to me ;) (apart from the broken tests - but that should be fixable quickly) |
8214d46
to
ac01ef6
Compare
Since #10443 shifts a lot of stones I'm afraid introducing a regression and pushing the timeline further. I think this PR is much more urgent than #10443, I would rather get this in, start collecting data and merge #10443 after the test is over (should take a couple of days only). What do you think? |
True, but I'd rather shift the timeline again, but test the final-ish version than to test this one, merge the fixes (when? after the a/b test finishes so as to not impact it?) and find out after rolling it out to everyone that it introduced a regression :/ Believe me when I tell you I want this out the door as much as you do 😀 But if we're making such big changes as in #10443, I'd rather introduce them before the A/B testing, not after. |
ac01ef6
to
d60d4be
Compare
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.
Not a blocker, but when tabbing between fields in the form, the phone's country list is not focused properly (you know, the one with the flag). It might be confusing for some users - maybe we can remove it from the tabbing order? (tabindex="-1"
should do the trick)
You can still select the empty option
between the popular countries and the rest (I swear I already reported this 🤔) - it will trigger a console error and the flag will be loading indefinitely.
Interesting bug (yaaaay 😕): start with a user that has no country pre-selected. Select a country (say, Poland). This will trigger to phone country to be Poland too (which is fine, of course). Now input a phone number starting with 1
- this will change the phone's country to USA. I'm not sure if this is intended - I'd wager that there's at least one country that could have a local phone number starting with 1?
wpcom.validateDomainContactInformation( fieldValues, domainNames, ( error, data ) => { | ||
const allFieldValues = Object.assign( {}, fieldValues ); | ||
if ( abtest( 'domainContactNewPhoneInput' ) === 'enabled' ) { | ||
allFieldValues.phone = toIcannFormat( allFieldValues.phone, countries[ this.state.phoneCountryCode ] ); |
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.
this.state.phoneCountryCode
is lowercase (see line 129), so this lookup fails (the keys in countries
are uppercase).
setDomainDetails( formState.getAllFieldValues( this.state.form ) ); | ||
const allFieldValues = Object.assign( {}, formState.getAllFieldValues( this.state.form ) ); | ||
if ( abtest( 'domainContactNewPhoneInput' ) === 'enabled' ) { | ||
allFieldValues.phone = toIcannFormat( allFieldValues.phone, countries[ this.state.phoneCountryCode.toLowerCase() ] ); |
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.
Similar problem as on line 92.
…is a NANPA country
d60d4be
to
a24b73e
Compare
👍
👍
👍 |
Tested, works and looks good 👍 Woohoo! 💃 |
I'm not sure removing it altogether would help. I have something WIP that generates actual phone numbers but that's not going to make it here. Maybe @breezyskies has something to say? |
Not altogether - put |
I see your point, the field allows both formats, but sometimes more experienced users can actually try to understand what the field expects from them, like whether to input in international format or not. Not having a clue can arise confusion. |
Switched placeholder to "Phone", we can look ways to improve it later. Fixed the issue with IE flag icon scaling as well. |
🎉 Fixes #10369.
The time has come.
This PR puts the new phone input to Domain Contact Form with 50% variation on AB test.
Teaser
Testing
domainContactNewPhoneInput
./cc: @wensco @aidvu @klimeryk