-
Notifications
You must be signed in to change notification settings - Fork 121
Account creation: design polishes - add a button to show/hide text field input for a secure field #8006
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
Conversation
You can test the changes from this Pull Request by:
|
itsmeichigo
left a comment
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 great! π I have a suggestion to fix the height change in the comment below.
Also - do you think we should extract this ZStack into a reusable view, in case we need it for a native login screen? It's something for the future, so we can do that later too.
| func _body(configuration: TextField<Self._Label>) -> some View { | ||
| configuration | ||
| .padding(10) | ||
| .padding(insets) |
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 like the change of height when switching between field types is due to vertical padding and the content height difference of SecureField and TextField.
A quick fix would be to add a fixed height, we may need to take scale into consideration:
| .padding(insets) | |
| .padding(insets) | |
| .frame(height: 44 * scale) |
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 some testing, the insets aren't the cause of the mismatched height, the height is just slightly different between the TextField and SecureField. In a09e7e3, I passed an optional height parameter for AccountCreationFormFieldView to set 44 * scale.
β¦sword-input * feat/7891-design-polishes: Make focused/unfocused border color configurable with previews. # Conflicts: # WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/TextFieldStyles.swift
β¦that the password field has the same height when the secure content is shown and hidden.
When we support login in the future, I was thinking we probably want to use the SwiftUI field view for both login and signup. So maybe we can just rename |
My suggestion was to create a generic |
I feel like the secure field is mostly useful during authentication π€ Let's go with the PR and we can create it when it's needed for another use case. |
Part of #7891
Based on #7995 just for easier testing
Description
To follow the design for the password field, this PR added an ποΈ button to
AccountCreationFormFieldViewwhen the view model'sisSecureistrue. Tapping on the button shows/hides the secure input. Because of the rounded border design, the reveal button has to be added using aZStackwith some custom insets to the text field style and button image size using@ScaledMetricfor dynamic type.One minor issue I noticed is the slight height change between the shown/hidden state. Please feel free to share any suggestions to fix it!
Testing instructions
Create a Store--> there should be an ποΈ/ icon with a slash in the password fieldScreenshots
RELEASE-NOTES.txtif necessary.