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: removed line height from all inputs #15804

Closed
wants to merge 3 commits into from

Conversation

allroundexperts
Copy link
Contributor

Details

This PR removes line height from all text inputs.

Fixed Issues

$ #14799
$ #14799 (comment)

Tests

  1. Open settings page.
  2. Open security settings, then click on close account.
  3. Type any text in the multiline input that appears.
  • Verify that no errors appear in the JS console

Offline tests

Not applicable

QA Steps

  1. Open settings page.
  2. Open security settings, then click on close account.
  3. Type any text in the multiline input that appears.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
Screen.Recording.2023-03-10.at.3.57.44.AM.mov
Mobile Web - Chrome

With LH:
https://user-images.githubusercontent.com/30054992/224184220-dd0f6f72-4ecb-419d-851a-fd0cb6897429.mp4

Without LH:
https://user-images.githubusercontent.com/30054992/224184244-052f750d-4dca-49e1-bb23-1b406099092a.mp4

Mobile Web - Safari

With LH:
https://user-images.githubusercontent.com/30054992/224184323-fef3c45a-6acf-4833-951b-ae8d846de4a1.mp4

Without LH:
https://user-images.githubusercontent.com/30054992/224184330-9cc0ef10-24ee-4ad0-be0b-e4da2caf7b20.mp4

Desktop
Screen.Recording.2023-03-10.at.3.59.44.AM.mov
iOS

With LH:
https://user-images.githubusercontent.com/30054992/224184440-55a50942-d446-4c26-affc-f874d7dc506a.mp4

Without LH:
https://user-images.githubusercontent.com/30054992/224184445-eca40ce6-4360-434a-be61-c9aed3186a16.mp4

Android

With LH:
https://user-images.githubusercontent.com/30054992/224184503-cd146bb8-91b4-45a7-b360-ba090d28240b.mp4

Without LH:
https://user-images.githubusercontent.com/30054992/224184511-3baa391f-ddf0-4282-b3cd-cc6854918190.mp4

@MelvinBot
Copy link

Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers!

@allroundexperts allroundexperts marked this pull request as ready for review March 9, 2023 23:37
@allroundexperts allroundexperts requested a review from a team as a code owner March 9, 2023 23:37
@melvin-bot melvin-bot bot requested review from aimane-chnaif and techievivek and removed request for a team March 9, 2023 23:37
@MelvinBot
Copy link

@techievivek @aimane-chnaif One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@aimane-chnaif
Copy link
Contributor

@allroundexperts this should be applied to composer as well

@allroundexperts
Copy link
Contributor Author

@aimane-chnaif Updated.

@allroundexperts allroundexperts requested review from aimane-chnaif and removed request for techievivek March 10, 2023 09:02
@@ -1400,6 +1401,9 @@ const styles = {

// Be extremely careful when editing the compose styles, as it is easy to introduce regressions.
// Make sure you run the following tests against any changes: #12669
Copy link
Contributor

Choose a reason for hiding this comment

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

@allroundexperts please test #12669 as comment says.
I don't think it's related but just to be safe.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aimane-chnaif Android and iOS attached.

Screen.Recording.2023-03-10.at.2.16.05.PM.mov
Screen.Recording.2023-03-10.at.2.18.18.PM.mov

@aimane-chnaif
Copy link
Contributor

Here's comparison per each platform:

diff.mov

cc: @shawnborton

@aimane-chnaif
Copy link
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web.mov
Mobile Web - Chrome
mchrome.mov
Mobile Web - Safari
msafari.mp4
Desktop
desktop.mov
iOS
ios.mp4
Android
android.mov

Copy link
Contributor

@aimane-chnaif aimane-chnaif left a comment

Choose a reason for hiding this comment

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

@shawnborton @techievivek please check videos, especially in #15804 (comment).
I think no problem with changes and approving but will defer to you.

@shawnborton
Copy link
Contributor

Hmm I'm gonna be honest, I don't love that now the composer box has a tighter line height - now the text you type doesn't match the same line height styling it would have when the text is sent and turned into a message. Is there a way to only do this for our text inputs and not the composer itself?

@aimane-chnaif
Copy link
Contributor

Is there a way to only do this for our text inputs and not the composer itself?

yes, we might not want to touch composer but unfortunately cursor flicker also happens in android on composer though barely noticeable to users.
Cursor height mismatch between first line and other lines on Safari, mSafari also happens but I think this one can be ignored if not really needed to fix.

@aimane-chnaif
Copy link
Contributor

aimane-chnaif commented Mar 10, 2023

@shawnborton so which options do you want this fixed by?

About composer:

  1. keep line height on all platforms (find better solution to fix glitch and if no solution, do nothing)
  2. remove line height on android only and keep on all other platforms (suggested)
  3. remove line height on all platforms (current PR)

Same options for other multiline inputs (close account, invite members)

@allroundexperts
Copy link
Contributor Author

@shawnborton @aimane-chnaif Just FYI, On android for the composer, there is a change in size of composer when you enter the first character of second line. This is also caused by the line height being set. Removing line height fixes that jump as well.

Screen.Recording.2023-03-10.at.9.31.28.PM.mov

@shawnborton
Copy link
Contributor

Interesting, got it. Okay, well I guess it makes sense to move forward with this and see how it feels then.

@aimane-chnaif
Copy link
Contributor

@allroundexperts can you also test #15864?

@allroundexperts
Copy link
Contributor Author

allroundexperts commented Mar 10, 2023

@allroundexperts can you also test #15864?

iOS:
With LH:
Screenshot 2023-03-11 at 3 56 49 AM

Without LH:
Screenshot 2023-03-11 at 3 55 53 AM

@aimane-chnaif
Copy link
Contributor

@allroundexperts can you also test #15864?

iOS: With LH: Screenshot 2023-03-11 at 3 56 49 AM

Without LH: Screenshot 2023-03-11 at 3 55 53 AM

oops. too close. can you also test and share android diff?

@shawnborton
Copy link
Contributor

Hmmm the lines on iOS feel way too close together now. I'm starting to think that maybe this is not the best solution just to fix a cursor glitch in Android. Are we sure there isn't a better solution that can solve the Android issue without causing all of these other design inconsistencies?

@allroundexperts
Copy link
Contributor Author

@allroundexperts can you also test #15864?

iOS: With LH: Screenshot 2023-03-11 at 3 56 49 AM
Without LH: Screenshot 2023-03-11 at 3 55 53 AM

oops. too close. can you also test and share android diff?
@aimane-chnaif

Screenshot 2023-03-11 at 4 06 39 AM

Screenshot 2023-03-11 at 4 07 21 AM

@shawnborton
Copy link
Contributor

Can you share before/after on iOS with two lines of text (no emojis) please?

@allroundexperts
Copy link
Contributor Author

Hmmm the lines on iOS feel way too close together now. I'm starting to think that maybe this is not the best solution just to fix a cursor glitch in Android. Are we sure there isn't a better solution that can solve the Android issue without causing all of these other design inconsistencies?

@shawnborton We probably should not apply this to composer. There isn't any noticeable flickering in the composer anyways. For Close account multiline input, it looks fine because there are no emojis there.

@allroundexperts
Copy link
Contributor Author

Can you share before/after on iOS with two lines of text (no emojis) please?

Screenshot 2023-03-11 at 4 11 02 AM

Screenshot 2023-03-11 at 4 11 26 AM

@aimane-chnaif
Copy link
Contributor

There isn't any noticeable flickering in the composer anyways

can you find root cause why barely noticeable in composer than other multiline inputs?
I think those have same lineHeight, fontFamily and fontSize right now.

it looks fine because there are no emojis there.

You still can input emoji though.

Hmmm the lines on iOS feel way too close together now. I'm starting to think that maybe this is not the best solution just to fix a cursor glitch in Android. Are we sure there isn't a better solution that can solve the Android issue without causing all of these other design inconsistencies?

I agree fixing cursor glitch is not more important than too close between lines.

@allroundexperts
Copy link
Contributor Author

There isn't any noticeable flickering in the composer anyways

can you find root cause why barely noticeable in composer than other multiline inputs? I think those have same lineHeight, fontFamily and fontSize right now.

it looks fine because there are no emojis there.

You still can input emoji though.

Hmmm the lines on iOS feel way too close together now. I'm starting to think that maybe this is not the best solution just to fix a cursor glitch in Android. Are we sure there isn't a better solution that can solve the Android issue without causing all of these other design inconsistencies?

I agree fixing cursor glitch is not more important than too close between lines.

It's because initially composer is a single line input. It only becomes multiline once you go over to the next line. With other inputs, they are multiline since the beginning.

@aimane-chnaif
Copy link
Contributor

Seeing #15864, I see that current lineHeight set for all texts are not big enough for emojis look good in multiline. (both input view and normal text view)

@aimane-chnaif
Copy link
Contributor

@shawnborton so which options do you want this fixed by?

About composer:

  1. keep line height on all platforms (find better solution to fix glitch and if no solution, do nothing)
  2. remove line height on android only and keep on all other platforms (suggested)
  3. remove line height on all platforms (current PR)

Same options for other multiline inputs (close account, invite members)

So now I'd like to get suggestions from both of you @shawnborton @techievivek

@shawnborton
Copy link
Contributor

Which one is before or after in this comment?

@aimane-chnaif
Copy link
Contributor

Which one is before or after in this comment?

I believe small one is after fix but this depends device font size.
If device font size is very small, after-fix is smaller.
If device font size is very big, after-fix is larger.

@allroundexperts
Copy link
Contributor Author

Which one is before or after in this comment?

@shawnborton Small one is after the fix.

@aimane-chnaif
Copy link
Contributor

How do we proceed here? @shawnborton @techievivek

@shawnborton
Copy link
Contributor

I kind of think we should go back to the drawing board here and try to find a better solution honestly. This one is starting to feel a bit hacky to me. Thoughts on that?

@aimane-chnaif
Copy link
Contributor

I kind of think we should go back to the drawing board here and try to find a better solution honestly. This one is starting to feel a bit hacky to me. Thoughts on that?

I agree. @techievivek if you +1, can we close this PR, go back to the issue and find better solution?
Sorry to @allroundexperts

@allroundexperts
Copy link
Contributor Author

@aimane-chnaif Thanks for letting me know. Do I get any compensation for this? Previously, I got paid if the PR was created but not merged due to this sort of issue. Ref

@aimane-chnaif
Copy link
Contributor

@aimane-chnaif Thanks for letting me know. Do I get any compensation for this? Previously, I got paid if the PR was created but not merged due to this sort of issue. Ref

I experienced this first time, so I am not sure. I will defer to @techievivek and @zanyrenney

@techievivek
Copy link
Contributor

Hmmm... it looks like getting rid of line height is not a good choice over here. @allroundexperts, do you think you can explore some other solution here, or should we close this PR and look for a better fix?

@allroundexperts
Copy link
Contributor Author

Hmmm... it looks like getting rid of line height is not a good choice over here. @allroundexperts, do you think you can explore some other solution here, or should we close this PR and look for a better fix?

@techievivek The only other solution I can think of is fixing this on the native side. I'm not sure if I'll be able to do it since I don't have good knowledge of the native code. I'm still not sure why we can't just apply this to the close account text input on android only?

@techievivek
Copy link
Contributor

@aimane-chnaif @shawnborton How about fixing this only for Android?

@allroundexperts has shared the screen recordings for Android.
With line-height:
https://user-images.githubusercontent.com/30054992/224184503-cd146bb8-91b4-45a7-b360-ba090d28240b.mp4

Without line-height:
https://user-images.githubusercontent.com/30054992/224184511-3baa391f-ddf0-4282-b3cd-cc6854918190.mp4

In case we don't feel confident with the above solution then I can reach out to Callstack developers and see if we can get anyone to work on this issue. Let me know what you guys think.

@aimane-chnaif
Copy link
Contributor

I think this is related to facebook/react-native#35951
App issue: #14367
I am not sure this issue will be fixed after enabling new architecture.
But yes, we can reach out to Callstack if they have solution in native way without removing lineHeight.

@techievivek
Copy link
Contributor

@aimane-chnaif Good catch. It looks like this should get fixed after enabling the new architecture.

@techievivek
Copy link
Contributor

Closing this PR as the callstack developers will be handling the linked issue now.

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.

5 participants