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
Use Field component in auth flows #2749
Conversation
This converts most fields in the registration form to use the Field component, except for the phone number, which is a left as a separate task because of the country dropdown menu.
By placing the Field's border on the Field component root instead of the input, it's easier to wrap it around additional elements that we'll soon stuff inside the field.
This allows Fields to have an optional prefix component which is placed inside the border of the Field and to the left of the input. Since this label animation would be complex to get right for this case, it is instead fixed to the top left if there is a prefix component. This canonical example of this today would be a phone number field which includes a country dropdown.
Now that we have prefix support in the Field component, we can also convert the phone number with country dropdown on registration.
This converts all fields in the forgot password form to use the Field component.
As with other auth flows, this converts inputs on the login page to use the Field component for consistent styling. The login type dropdown is left as-is for now.
This converts the login type Dropdown on the login flow to also use the Field component so that every presents a similar visual style.
<Field | ||
className={pwFieldClass} | ||
id="mx_PasswordLogin_password" | ||
ref={(e) => {this._passwordField = e;}} |
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.
tbh I'm a little surprised the linter isn't screaming about this.
also TIL that this is the recommended way to do refs now.
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, several things to say here...
- I happen to just be moving existing
refs
code here, as I didn't want to change that much since it's not directly related (other auth modules still use older strings refs, for example). (I was worried you'd be sad I was mixing too much in one PR if I also clean up those sorts of code style things!) - Is it the spacing that you'd expect linting errors for?
- Since string refs are deprecated, we may want to enable the
react/no-string-refs
linting rule and clean then up
This changes to the Field component throughout the auth flows for consistent, modern visual styling.
Reviewer: Each commit in this PR is self-contained and has some additional context in the commit message, so you may want to review commit by commit.
Fixes element-hq/element-web#8262