Skip to content
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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

KshitizSareen
Copy link

@KshitizSareen KshitizSareen commented Dec 20, 2022

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

@chrisbobbe
Copy link
Contributor

Hi @KshitizSareen, thank you!

Could you please post some screenshots of the proposed change?

@KshitizSareen
Copy link
Author

Hi @chrisbobbe, Thank you for your message. Let me attach the screenshots.

@KshitizSareen
Copy link
Author

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,
Kshitiz.

Copy link
Contributor

@chrisbobbe chrisbobbe left a 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, and bottom attributes of styles.showPasswordButton.

I think it makes sense for this change to be in just one clear, coherent commit.

},
showPasswordButtonText: {
margin: 8,
color: BRAND_COLOR,
},
passwordTextInput: {
paddingRight: '15%',
Copy link
Contributor

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)

Comment on lines 19 to 22
borderTopWidth: 1,
borderColor: BORDER_COLOR,
borderBottomWidth: 1,
borderRightWidth: 1,
Copy link
Contributor

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).

@KshitizSareen
Copy link
Author

KshitizSareen commented Dec 28, 2022

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:

Screenshot 2022-12-28 at 3 18 01 PM

We could do away with borders entirely, to make it look like this (Similar to Android):

Screenshot 2022-12-28 at 3 19 30 PM

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.mov

To resolve this issue, I propose we could use some icons instead of the show/hide text. It looks better and more intuitive.
We could use icons like these instead of show/hide:

Screenshot 2022-12-28 at 3 26 54 PM

Screenshot 2022-12-28 at 3 27 00 PM

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,
Regards,
Kshitiz.

@chrisbobbe
Copy link
Contributor

To resolve this issue, I propose we could use some icons instead of the show/hide text. It looks better and more intuitive.
We could use icons like these instead of show/hide:

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 Input component differently on Android and iOS, and we'd like to make sure it looks reasonable on both. If it's difficult for you to set up, please let me know and I can test your revision and post screenshots.

@KshitizSareen
Copy link
Author

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.

@richab246
Copy link

Can I work on this issue?

@chrisbobbe
Copy link
Contributor

chrisbobbe commented Jan 7, 2023

@richab246, please find a different issue to work on; @KshitizSareen is working on this one.

@KshitizSareen
Copy link
Author

@KshitizSareen KshitizSareen force-pushed the zulip-mobile-branch branch 2 times, most recently from eec7e74 to 7652659 Compare January 9, 2023 11:23
Copy link
Contributor

@chrisbobbe chrisbobbe left a 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).

<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} />
Copy link
Contributor

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?

@@ -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';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import Icon from 'react-native-vector-icons/Ionicons';
import { Icon } from '../common/Icons';

@KshitizSareen
Copy link
Author

KshitizSareen commented Jan 20, 2023

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:
https://user-images.githubusercontent.com/23134343/213664807-cdd6c6ee-1adc-428f-8c1f-0268c1707c1a.mov

This is for Iphone:

Show.Hide.Password.Demo.for.IPhone.mov

I have pushed the changes.

Thank you.

@chrisbobbe
Copy link
Contributor

Thanks! Please squash your fixup commits into the main, interesting commit, and give that commit a commit message according to our style.

@KshitizSareen
Copy link
Author

Hi @chrisbobbe , I squashed all my commits.

Please review.

Thanks.

@chrisbobbe
Copy link
Contributor

Thanks! Some commit-message nits before I hand this off to Greg to review:

  • Please make sure your summary line is 76 characters or less.
  • For the prefix, use the name of a subsystem instead of "fix". The name of a UI component often works; I think "PasswordInput" would be fine here.
  • Please end your commit message with Fixes: #5614 (no period, capital "F").

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.

@KshitizSareen
Copy link
Author

Thank you @chrisbobbe.

I will change the commit message, and I will be more careful from now on.

Thank you.

@KshitizSareen KshitizSareen force-pushed the zulip-mobile-branch branch 3 times, most recently from d3cf64a to 9b1065c Compare January 26, 2023 05:25
@KshitizSareen
Copy link
Author

Hi @chrisbobbe , I pushed some changes.

Please review.

Thanks.

@chrisbobbe
Copy link
Contributor

Thanks! A few nits in the updated commit message:

PasswordInput: Fixed Overlap for long Passwords and show/hide button

Long Passwords and show/hide buttons overlap with each other.
I fixed this problem by doing the following:

- I changed the style of Password Text Input to take up as much space as needed. I did this by setting a flex of 1 to the password text 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: #5614
  • The summary line should say "Fix" instead of "Fixed", and there's no need to capitalize "overlap" or "passwords".

  • The paragraph content in the body should be wrapped to about 68 characters per line, but no more than 70.

https://zulip.readthedocs.io/en/latest/contributing/commit-discipline.html#commit-messages

@KshitizSareen
Copy link
Author

Hi @chrisbobbe ,

Apologies for the delay.

I fixed up the commit message.

Please review.

Regards,
Kshitiz.

KshitizSareen and others added 6 commits February 10, 2023 10:30
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.
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/
@chrisbobbe
Copy link
Contributor

chrisbobbe commented Feb 10, 2023

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
4b78875 PasswordInput: Add 8px margin between password input and show/hide button
3682bc3 PasswordInput: Don't let show/hide button stretch password input's height
322b330 PasswordInput: Give show/hide button a 48px touch target size
3f3324f PasswordInput: Use Pressable for show/hide icon button
9c473e1 PasswordInput: Add accessibility properties to 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. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The password text entry and Hide/Show button overlap for long passwords
3 participants