-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Make login form accessible to Password Managers #5275
Conversation
Conflicts! |
src/pages/signin/PasswordForm.js
Outdated
textContentType="password" | ||
nativeID={getPasswordAutocompleteType()} |
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 curious but what do we need to set the nativeID
for ?
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.
For Attaching the label with input. This could be optional. There are a lot of uncertainties in the case of password Managers so I used everything that we generally do for login forms. Another reason was to just point out these things in the review and decide if they are necessary.
|
||
componentDidMount() { | ||
// These native props are needed for Password Managers like LastPass | ||
if (this.form) { |
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.
early return please
// These native props are needed for Password Managers like LastPass | ||
if (this.form) { | ||
setNativePropsWeb(this.form, 'method', 'post'); | ||
setNativePropsWeb(this.form, 'action', '/'); |
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.
We should encapsulate this logic in a new kind of view then pass these as props. The component can then handle setting these native props with this componentDidMount()
logic instead of having to repeat it everywhere we want to do this.
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.
Also please add some comments about why method
and action
are required in this case
@@ -44,6 +45,9 @@ class BaseExpensiTextInput extends Component { | |||
if (this.props.autoFocus && this.input) { | |||
this.input.focus(); | |||
} | |||
if (this.input && this.props.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.
If there is no input we should return early instead of checking on like 48 and 45
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.
Yes, absolutely.
Thanks for the review Marc. I will resolve them as soon as possible. |
What's the status on this one @parasharrajat ? |
Not yet updated. I will ping you when done. |
@rushatgabhane Could you please review this and tell me if it works for you? |
I tested this branch with Bitwarden as my password manager. Screencast.from.07-11-21.11-47-33.AM.+03.mp4 |
@rushatgabhane Thanks for testing it. I have pushed new changes, please check again. Let's see I tested with lastpass. |
@parasharrajat Works perfectly! 💯 |
Thanks, @rushatgabhane. It would have not been possible without your help. If you are curious to know, what was the issue?
To fix this, we have to keep all the form fields, login, and password in the dom, keeping the relation between them. Also, as we use the multistep form, I have to visually hide the other dom nodes based on the current step to keep the UI intact. |
Thanks for the clarity. It makes sense now :) |
I will soon finalize the PR. All changes are done. Cleanup is left. |
@marcaaron Ready for review. Major refactor... 😄 |
src/components/CollapsibleView.js
Outdated
isVisible: false, | ||
}; | ||
|
||
const CollapsibleView = props => ( |
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.
ToggleVisibilityView
maybe? Collapsible makes me think of things like this -> https://github.com/Eliav2/react-native-collapsible-view
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.
Yup, Thanks for the better name
import textInputWithNamepropTypes from './textInputWithNamepropTypes'; | ||
|
||
/** | ||
* On web we need to set the native attribure name for accessiblity. |
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.
attribute
src/pages/signin/SignInPage.js
Outdated
</CollapsibleView> | ||
<CollapsibleView isVisible={showPasswordForm}> | ||
{isVisible => <PasswordForm isVisible={isVisible} />} | ||
</CollapsibleView> |
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.
After seeing this I think this utility would be a bit cleaner as an HOC. Passing the prop only to immediately consume it looks kind of funny.
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.
Hmm. Let me do it that way.
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.
Actually, prop is used to manage side effects based on visibility.
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 maybe pass the prop through to the wrapped component?
Ready. |
Ready for 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.
Looks good - just have a few more suggestions.
* Clear Login from the state | ||
*/ | ||
clearLogin() { | ||
this.setState({login: ''}, this.input.clear); |
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.
Why call clear on this? Is ExpensiTextInput
not a controlled component?
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.
Yeah. It's not. I just saw that we don't pass the value directly. ExpensiTextInput
is using value={this.value}
. Actually, we never faced a situation to make it controlled.
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.
Oh hmm weird I don't get it. We are passing a value - is it used or not ? 🤔
It seems like a bad habit to call this.input.clear
every time we update a value passed to ExpensifyTextInput
to be an empty string. Why do we need to do this?
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 wasn't using it before but after recent changes, ExpensifyTextInput
value is not clearing on updating the state variable login. But as soon as you blur it, values clear. So I think that using this.value
instead of the state variable is causing this issue on ExpensifyTextInput
.
As far as I know, it's not affecting other parts of the app so I don't think that refactor is necessary. If we face this issue again then I would suggest making the ExpensifyTextInput
controlled.
Changes Done. |
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'm not too sure about that this.input.clear
usage - feels like something we should not have to worry about.
@Jag96 This is ready for review and 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.
Looks good and tests well, looks like just one copy-paste mistake
@@ -36,6 +36,7 @@ class ExpensiTextInputLabel extends PureComponent { | |||
} | |||
} | |||
|
|||
ExpensiTextInputLabel.propTypes = propTypes; | |||
ExpensiTextInputLabel.propTypes = expensiTextInputLabelPropTypes.propTypes; | |||
ExpensiTextInputLabel.propTypes = expensiTextInputLabelPropTypes.defaultProps; |
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.
ExpensiTextInputLabel.defaultProps =
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.
Yeah, Nice catch.
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.
Done.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Unfortunately, found an issue with this PR. The keyboard does not close when you switch between the login and password pages on Android. As a side-effect, View is not correctly placed above the keyboard when the page changes. It happens due to I guess, we will have to manually blur the input when |
🚀 Deployed to production by @roryabraham in version: 1.1.18-3 🚀
|
Details
Fixed Issues
$ #3855
$ #5956
Tests | QA Steps
Tested On
Screenshots
Web
Updating Shortly...
Mobile Web
Desktop
iOS
Android