-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Highlight all errors in VBA flow - Company step #5073
Conversation
Add props to receive error in ExpensiPicker Set red outline based on the error received Display optional error text in ExpensiPicker
Update: Removed WIP/Draft. Handle error outline for StatePicker. |
@@ -80,58 +80,107 @@ class CompanyStep extends React.Component { | |||
'password', | |||
'companyPhone', | |||
]; | |||
|
|||
// Keys in this.errorTranslationKeys are associated to inputs, they are a subset of the keys found in this.state |
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.
NAB: I read this comment a few times and couldn't understand the purpose until I looked at usages in the code.
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 changed it, is it better or worse? :P
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 think there's some potential to improve ExpensiTextInput
further and to delegate some of the error logic to the component, but this isn't an N6 blocker.
src/components/ExpensiPicker.js
Outdated
/** Should the input be styled for errors */ | ||
hasError: PropTypes.bool, |
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.
NAB: It kinda feels like we're tying the prop to UI here, I would have thought the prop should simply describe state, rather than what we do with that state. But I could be wrong, and this is not a huge deal I guess.
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.
What would the alternative be here? FWIW this seems to be how we're handling things in the ExpensiTextInput
App/src/components/ExpensiTextInput/propTypes.js
Lines 13 to 17 in 3e11093
/** Error text to display */ | |
errorText: PropTypes.string, | |
/** Should the input be styled for errors */ | |
hasError: PropTypes.bool, |
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.
NAB: It kinda feels like we're tying the prop to UI here, I would have thought the prop should simply describe state, rather than what we do with that state. But I could be wrong, and this is not a huge deal I guess.
Are you saying that the comment should be updated? or the itself prop is not well defined?
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.
Tested web and the forms are working as expected.
I see a few improvements (scroll to error on mobile, highlight API forms), but I see that we're aware of this and still discussing here.
Hey @marcaaron, did you want (and have time) to review this PR? If yes then I'll await your review. |
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.
Looking good ! Left some comments / notes.
src/components/ExpensiPicker.js
Outdated
/** Should the input be styled for errors */ | ||
hasError: PropTypes.bool, |
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.
What would the alternative be here? FWIW this seems to be how we're handling things in the ExpensiTextInput
App/src/components/ExpensiTextInput/propTypes.js
Lines 13 to 17 in 3e11093
/** Error text to display */ | |
errorText: PropTypes.string, | |
/** Should the input be styled for errors */ | |
hasError: PropTypes.bool, |
value={this.state.addressState} | ||
hasError={this.getErrors().addressState} |
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.
Are we going to add a label for this one?
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 was just putting the red outline because there is little space under the StatePicker
, do you want me to test how it would look with the error text there?
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.
Could we show the inline message in the space here?
Any thoughts @shawnborton ? Or should we just let this one go?
Can't click "Save & continue" when there are inputs that are blank
Update: I decided to stick to leaving the "Save & continue" button disabled if there is any empty field (including terms and conditions checkbox). Why?:
Considering this, the following changed:
The following should be addressed in a future PR:
We have a GH issue and @pecanoro has a PR already on the way for it. |
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.
Just a couple more comments. This is looking really great.
return !_.isEmpty(value); | ||
} | ||
return Boolean(value); | ||
} |
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.
NAB, I like this method. My one hesitation is whether the boolean case makes the name confusing b.c. a boolean with a false
is technically "present" it's just false
.
For the boolean case we are just returning the boolean again not whether it has a value or not.
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 had the same concern about booleans, maybe it would be cleaner to consider true
and false
as present. Then, we just handle the case of the "terms and conditions" checkbox without this function.
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, made a small change here. false
and true
(booleans) are considered "present". Therefore, we are not using this function to test the value for hasNoConnectionToCannabis
.
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 cool I think this works for now. Probably we will want to think about this some more when we build a more generic form component and need a generic way to test that a field marked as "required" when a boolean will be tested for "existing" and "true".
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 cool I think this works for now. Probably we will want to think about this some more when we build a more generic form component and need a generic way to test that a field marked as "required" when a boolean will be tested for "existing" and "true".
Yes, I think this is a good idea. Postpone thinking further about this until we have more cases or a more generic.
Ok good call. Sounds like this is a blocker for this issue to remove the disabled feature so we can maybe take care of this there.
Just to clarify, since we are not able to add this for the checkbox you'd think it would be better to add inline handling later as well? |
Yes. In this PR we are keeping the "Save & continue" button disabled if there is any empty field. The "Save & continue" button doesn't become enabled until we have chosen all states (StatePicker) and the company type (ExpensiPicker), so these highlights were not going to be used/shown under this configuration. Same thing applies for the inline highlight of the checkbox component. I think these things should be added together with making the "Save & continue" button always enabled, because then we will have the case where we want to inline an error in those inputs. |
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.
LGTM. I only really have one small note left about the comment in the isValuePresent
method. Once that is resolved I'm ready to merge.
} | ||
|
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.
NAB, removing these new lines seems unnecessary. I like them personally since things are less visually compressed, but that's just my opinion and there are no style rules about this as far as I know.
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.
Got mixed up with the php guidelines. I assumed that a similar rule would apply here... reverting!
Update:
|
Going to merge this so we can keep plugging away at the remaining steps. @Julesssss thanks for your review and please let us know if you've got any additional comments that we can follow up on if they were not resolved. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by @marcaaron in version: 1.0.98-2 🚀
|
cc @marcaaron
Brought some of the functionality implemented in this dead PR
Investigate: can functions like
clearErrorAndSetValue
be reused somehow? We will need to repeat this and other functions in every step.Details
Changes:
Fixed Issues
$ #4785
We are working in this issue step by step. This PR updates the error handling specifically for the company information step in the VBA flow.
Tests AND QA Steps
/bank-account/company
/bank-account
by selecting the workspace and tapping the "Get Started" buttonLog in into your bank
Zip code
,Company website
,Tax ID number
andIndustry classification code
. Invalid data could be for example1
.Please double check any highlighted fields and try again.
and see all fields with inline highlighted errors at the same time:123
. Valid values:Zip Code
: 123456Company website
: https://test.comTax ID number
: 123456789Industry classification code
: 123456Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android