-
-
Notifications
You must be signed in to change notification settings - Fork 656
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
fix: Overlap for long passwords and show/hide button in Password Auth Screen Issue #: 5614 #5621
base: main
Are you sure you want to change the base?
Conversation
Hi @KshitizSareen, thank you! Could you please post some screenshots of the proposed change? |
Hi @chrisbobbe, Thank you for your message. Let me attach the screenshots. |
Screen.Recording.2022-12-20.at.5.05.53.PM.mov@chrisbobbe I have attached a small video showing the fix. Please let me know if you have need any more details. Regards, |
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.
Thanks! Comments below.
I think they're most easily addressed by giving up the design where the show/hide button appears inside the border (which is iOS only). Let's try removing the absolute positioning, and just let the button take up the horizontal space it needs, with the <Input />
stretching to fill what horizontal space is left.
Here's a sketch of a possible implementation:
flexDirection: 'row'
on the parent<View />
flex: 1
on the<Input />
- Remove the
position
,right
,top
, andbottom
attributes ofstyles.showPasswordButton
.
I think it makes sense for this change to be in just one clear, coherent commit.
src/common/PasswordInput.js
Outdated
}, | ||
showPasswordButtonText: { | ||
margin: 8, | ||
color: BRAND_COLOR, | ||
}, | ||
passwordTextInput: { | ||
paddingRight: '15%', |
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, I'd rather not use a percentage here. We should reserve exactly the right amount of space for the show/hide button, and this will cause that space to be too large or small depending on factors including:
- How wide the input is (e.g., varies with screen width; will be large on a tablet)
- How big the show/hide button's text is (varies with the user's chosen font size in system settings)
src/common/PasswordInput.js
Outdated
borderTopWidth: 1, | ||
borderColor: BORDER_COLOR, | ||
borderBottomWidth: 1, | ||
borderRightWidth: 1, |
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 expect this to look odd on Android, where the inputs aren't styled with a border (see use of Platform.select
in Input.js).
Hi @chrisbobbe , Thank you so much for your comments. I tried to incorporate your changes. I removed the absolute positioning and added flex-direction: 'row' to the view. Unfortunaltely, that wont look very good with borders. It adds a small break between the password text input and the show/hide button. It looks something like this: We could do away with borders entirely, to make it look like this (Similar to Android): Another issue is the margin of the show/hide button. Since show has a bigger width than height, its margin causes the password text input to shrink. It works something like this: Screen.Recording.2022-12-28.at.3.13.56.PM.movTo resolve this issue, I propose we could use some icons instead of the show/hide text. It looks better and more intuitive. Since they always occupy a fixed size, their margin also wont cause a problem. Please let me know if you want to discuss on this. I look forward to your response. Thank you, |
Sure, that seems like a fine thing to try. Do you have the development environment set up to test on Android too? We style the |
Hi @chrisbobbe, Thanks for your comments. I have emulators for the platforms, and I will make sure to test on both Android and IOS. Let me code it up and show the proposed changes. Thanks. |
Can I work on this issue? |
@richab246, please find a different issue to work on; @KshitizSareen is working on this one. |
Hi @chrisbobbe, I made the proposed changes. Please review them. This is for Android: This is for IOS: Thank you, |
eec7e74
to
7652659
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.
Thanks, @KshitizSareen! See two small comments below. Also, in your next revision, please format your commit message according to our style (I linked to it upthread).
src/common/PasswordInput.js
Outdated
<Touchable style={styles.showPasswordButton} onPress={handleShow}> | ||
<ZulipTextIntl style={styles.showPasswordButtonText} text={isHidden ? 'show' : 'hide'} /> | ||
<Icon name={isHidden ? 'eye-off' : 'eye'} size={20} style={styles.showPasswordButtonIcon} /> |
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 default to using size 24 for icons; what does it look like with 24 instead of 20?
src/common/PasswordInput.js
Outdated
@@ -3,24 +3,26 @@ import React, { useState, useCallback } from 'react'; | |||
import type { Node } from 'react'; | |||
import { View } from 'react-native'; | |||
|
|||
import Icon from 'react-native-vector-icons/Ionicons'; |
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.
import Icon from 'react-native-vector-icons/Ionicons'; | |
import { Icon } from '../common/Icons'; |
Hi @chrisbobbe, Thanks for your comments. I changed the font-size to 24, and I imported Icon from Icons.js in the common folder. It looks like this: This is for tablet: This is for Iphone: Show.Hide.Password.Demo.for.IPhone.movI have pushed the changes. Thank you. |
Thanks! Please squash your fixup commits into the main, interesting commit, and give that commit a commit message according to our style. |
0b8ee85
to
e38a6b3
Compare
Hi @chrisbobbe , I squashed all my commits. Please review. Thanks. |
Thanks! Some commit-message nits before I hand this off to Greg to review:
This is all covered in https://zulip.readthedocs.io/en/latest/contributing/commit-discipline.html. I highly recommend browsing the project's history to get a sense of our commit-message style, in addition to reading the docs. |
Thank you @chrisbobbe. I will change the commit message, and I will be more careful from now on. Thank you. |
d3cf64a
to
9b1065c
Compare
Hi @chrisbobbe , I pushed some changes. Please review. Thanks. |
Thanks! A few nits in the updated commit message:
https://zulip.readthedocs.io/en/latest/contributing/commit-discipline.html#commit-messages |
9b1065c
to
ff4e8a3
Compare
5bbfcf2
to
ff4e8a3
Compare
Hi @chrisbobbe , Apologies for the delay. I fixed up the commit message. Please review. Regards, |
Long passwords and show/hide buttons overlap with each other. I fixed this problem by doing the following: - I changed the style of Password Input to take up as much space as needed. I did this by setting a flex of 1 to the Password Input. - I changed the positioning of the show/hide button from absolute to relative. - I ensured horizontal alignment by setting the flex-direction of the parent view to 'row'. - To fix the problem of the changing width of the text input, when the show/hide text changes, I replaced the show/hide text with a show/icon. The show/hide icon is an eye-open/eye-closed icon. This icon always has a fixed width and does not affect the text input. - I removed hide text from messages_en.json since it is not in the app. I tested this on Android and IOS devices with different screen sizes, and it works fine on both platforms. Fixes: zulip#5614
…tton The touchable-feedback area was right up against the right edge of the password input. Give some margin in between, for some breathing room.
…ight The default value for `alignItems` is 'stretch': https://reactnative.dev/docs/0.68/flexbox#align-items
This lets us have a more compact layout (e.g., the left edge of the icon is just 8px away from the right edge of the password input, instead of that 8px plus 12px of padding in the Touchable) while maintaining the 48px touch-target size with the help of `hitSlop`.
Now, after changing the show/hide button to be an icon instead of text, we still present user-facing text to screen reader software. Tested on iOS with VoiceOver, and implemented with help from this article: https://incl.ca/show-hide-password-accessibility-and-password-hints-tutorial/
6a8246d
to
9c473e1
Compare
Thanks! I've just pushed a revision with a few small tweaks to the layout; please take a look: c0d475a PasswordInput: Fix overlap for long passwords and show/hide button Here's a video from after those small changes, to compare with the video of your revision that you posted (thanks again 🙂) at #5621 (comment): And a screenshot with the touchable area highlighted ([shake] -> Show Inspector -> Touchables): @gnprice, this is ready for your review. 🙂 |
In the Password Auth Screen, when you type a long password, it overlaps with the show/hide button.
I fixed this issue by creating a new stylesheet for the password text input field. I added a padding-right property of 15% to its style. This fix will ensure that the text input in the password field will never exceed a width of 85% of the text input field.
I tested this commit by viewing the password auth screen in horizontal and vertical views. The password input field is working fine in both instances.
Please let me know if you have any questions.
Thank you.
Fixes: #5614.
(added by Chris:)
Replaces: #4084