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 composer early line break #15243

Merged
merged 2 commits into from
Feb 28, 2023
Merged

Conversation

bernhardoj
Copy link
Contributor

Details

When we are typing on the composer, the new line appears early even we are still on the current line.

Fixed Issues

$ #14934
PROPOSAL: #14934 (comment)

Tests

  1. Open any chat
  2. Type anything on the composer until you reach the end of the line
  3. Verify the next line does not appear yet and only appears after you add more text which will be put on the next line.
  • Verify that no errors appear in the JS console

Offline tests

  1. Open any chat
  2. Type anything on the composer until you reach the end of the line
  3. Verify the next line does not appear yet and only appears after you add more text which will be put on the next line

QA Steps

  1. Open any chat
  2. Type anything on the composer until you reach the end of the line
  3. Verify the next line does not appear yet and only appears after you add more text which will be put on the next line
  • 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
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • 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-02-17.at.00.33.28.mov
Mobile Web - Chrome
330544.t.mp4
Mobile Web - Safari
Screen.Recording.2023-02-17.at.01.45.31.mov
Desktop
Screen.Recording.2023-02-17.at.00.59.16.mov
iOS
Screen.Recording.2023-02-17.at.02.11.42.mov
Android
330545.t.mp4

@bernhardoj bernhardoj requested a review from a team as a code owner February 17, 2023 10:15
@melvin-bot melvin-bot bot requested review from roryabraham and sobitneupane and removed request for a team February 17, 2023 10:15
@MelvinBot
Copy link

@roryabraham @sobitneupane 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]

@bernhardoj
Copy link
Contributor Author

bernhardoj commented Feb 17, 2023

Sorry for taking it long. I found an issue on Safari.

After setting the number of lines state to 3, the scrollbar will not be shown anymore and the character at the 3rd line before goes back to the 2nd line.

Previously in my proposal, I said that after the scrollbar is hidden, the text will reposition. However, this is not the case with Safari.

Screen.Recording.2023-02-17.at.02.03.07.mov

You can see in the video after I add more text, the text will reposition correctly. That's why I changed the condition to < max lines instead, so the scrollbar will always be hidden except when the number of lines equal to the max lines.

This solves the early line break issue well, but still the overflow issue on Safari raises another existing issue. You can see the comparison video below between edge and safari.

Edge Safari
1.New.Expensify.-.Personal.-.Microsoft.Edge.2023-02-17.17-57-49.mp4
Screen.Recording.2023-02-17.at.02.00.42.mov

Here is the step:

  1. Type 16 lines (max line) of text
  2. Type a character to make the scroll appears
  3. Remove the character you just added

On Safari, the scroll still appears, while on other browsers the scroll disappears which is what we expect. I need to delete 2 lines of text before the scroll disappears on Safari.

Note: for the first step, you just need to type 15 lines on production because of the early line break issue.

I was trying to find a workaround for it so we can just use the first proposed condition, but I can't find a simple and not raising another issue workaround. So, I decided to not handle it here.

@sobitneupane
Copy link
Contributor

sobitneupane commented Feb 20, 2023

@bernhardoj

but still the overflow issue on Safari raises another existing issue.

Can you please elaborate more on "overflow issue on Safari". Are there any pre-existing issues related to this?

You mentioned "existing issue". Is this issue reproducible on Staging/Production?

@bernhardoj
Copy link
Contributor Author

bernhardoj commented Feb 20, 2023

On Safari, when we set the overflow to hidden, the text won't be repositioned until we type something (I type space on the video below). This is what I mean with the overflow issue. It's a Safari issue. Well, actually Safari possibly intended to do it like that.

Screen.Recording.2023-02-20.at.04.24.43.mov

Yes, it's happening on production, you can take a look at the last 2 video from my previous comment.

@sobitneupane
Copy link
Contributor

sobitneupane commented Feb 20, 2023

Yes, it's happening on production, you can take a look at the last 2 video from my previous comment.

The video attached for Safari is not on Prod, it's on Dev.

@bernhardoj
Copy link
Contributor Author

Ah, yes you are right, I recorded it on dev. It's not possible to reproduce it on prod because of the early line break. But the main point I want to say is on my previous comment.

@sobitneupane
Copy link
Contributor

@bernhardoj So, the issue is introduced by the introduction of overflow:hidden. Can you think of any other way to solve this issue without use of overflow:hidden.

@bernhardoj
Copy link
Contributor Author

bernhardoj commented Feb 20, 2023

Not really. The overflow issue is from Safari, not from our App.

Screen.Recording.2023-02-20.at.06.26.14.mov

You can see at the video above, after I type 'n', the scrollbar appears, and the 'n' is on the third line. However, removing the 'n' does not hide the scrollbar and requires us to delete more character.

So, basically there are 2 Safari issues both related to the overflow (scrollbar). The first one can be solved by changing the condition to < numberOfLines, while the 2nd one I don't find any workaround for it.

@sobitneupane
Copy link
Contributor

@roryabraham The change will create some inconsistent behavior between Safari and Other browsers as described by @bernhardoj here. What are your thoughts on this?

@bernhardoj
Copy link
Contributor Author

I guess we are still waiting for @roryabraham thoughts.

@roryabraham
Copy link
Contributor

I think the safari bug that @bernhardoj described here is really not a problem that we need to concern ourselves with. So no concerns from me there. Let's move forward with this PR.

Copy link
Contributor

@sobitneupane sobitneupane left a comment

Choose a reason for hiding this comment

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

Screenshots/Videos

Web
Screen.Recording.2023-02-28.at.11.40.35.mov
Mobile Web - Chrome
Screen.Recording.2023-02-28.at.12.00.49.mov
Mobile Web - Safari
Screen.Recording.2023-02-28.at.12.12.05.mov
Desktop
Screen.Recording.2023-02-28.at.11.54.03.mov
iOS
Screen.Recording.2023-02-28.at.12.03.09.mov
Android
Screen.Recording.2023-02-28.at.12.05.55.mov

Copy link
Contributor

@sobitneupane sobitneupane left a comment

Choose a reason for hiding this comment

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

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.

Copy link
Contributor

@sobitneupane sobitneupane left a comment

Choose a reason for hiding this comment

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

Changes look good and test well.

cc: @roryabraham

@roryabraham roryabraham merged commit f730c16 into Expensify:main Feb 28, 2023
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions
Copy link
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

Name Duration
Open Search Page TTI 609.524 ms → 680.671 ms (+71.146 ms, +11.7%) 🔴
Show details
Name Duration
Open Search Page TTI Baseline
Mean: 609.524 ms
Stdev: 19.667 ms (3.2%)
Runs: 586.5603429991752 586.8965659998357 587.7226560004056 588.6631269995123 589.3148600012064 589.4904379993677 590.8706870004535 592.2515050005168 593.0539549998939 593.9318849984556 595.8894859999418 597.395060999319 598.1852219998837 598.5560309998691 601.9547530002892 605.49930800125 605.5654300004244 606.6647540014237 614.0731199998409 614.8381760008633 616.0224200002849 619.2604569997638 620.4117029998451 621.418335000053 624.0801189988852 624.5648599993438 625.0249030012637 631.4613850004971 633.140544001013 633.5676269996911 652.3149419985712 666.1365559995174

Current
Mean: 680.671 ms
Stdev: 23.515 ms (3.5%)
Runs: 622.4232180006802 654.0904130004346 654.4227699991316 654.4809169992805 654.9092619996518 656.4359130002558 659.7755539994687 661.3487560003996 663.4803880006075 666.5823169983923 668.1732589993626 670.777425000444 675.5406899992377 675.7600100003183 676.402831999585 678.8719490002841 679.0324300006032 680.1668710000813 681.312784999609 682.7568359989673 682.8387449998409 683.9333100002259 685.1418460011482 685.4139399994165 695.8610020000488 703.1372079998255 705.7287600003183 706.3980310000479 708.3488769996911 716.124797001481 718.2860519997776 721.8651130013168 732.3070069998503

Meaningless Changes To Duration

Show entries
Name Duration
App start TTI 700.839 ms → 723.713 ms (+22.874 ms, +3.3%)
App start runJsBundle 188.633 ms → 201.813 ms (+13.179 ms, +7.0%)
App start nativeLaunch 19.966 ms → 20.200 ms (+0.234 ms, +1.2%)
App start regularAppStart 0.013 ms → 0.014 ms (+0.001 ms, +7.7%)
Show details
Name Duration
App start TTI Baseline
Mean: 700.839 ms
Stdev: 26.475 ms (3.8%)
Runs: 661.5288559999317 664.602079000324 669.4215580001473 671.0309769995511 673.7112109996378 675.0508120004088 675.6529460009187 678.4688770007342 681.5174989998341 682.1508319992572 684.916975999251 688.5951000005007 689.03241099976 689.0680899992585 690.6629429999739 693.1757769994438 698.7029190007597 701.1545870006084 705.1020669993013 710.1784119997174 710.3422529995441 710.7259619999677 711.282037999481 713.9706629998982 719.4654270000756 720.1512139998376 720.5621050000191 734.9543900005519 735.3858369998634 742.6238790005445 748.3834620006382 775.2832670006901

Current
Mean: 723.713 ms
Stdev: 29.022 ms (4.0%)
Runs: 673.3004260007292 684.0615449994802 686.6460599992424 689.0340720005333 692.6002709995955 692.7082609999925 694.6623730007559 698.6135699991137 701.1032069995999 706.2029699999839 706.5848750006407 708.9790790006518 709.9764089994133 711.9960500001907 712.118328999728 721.8276370000094 722.5095780007541 726.3153760004789 727.8496800009161 730.3768370002508 731.6733589991927 735.0334399994463 735.4879459999502 744.4789790008217 754.3649269994348 754.4538289997727 755.3565940000117 760.2558839991689 761.7675359994173 763.406142000109 776.5380169991404 788.5254110004753
App start runJsBundle Baseline
Mean: 188.633 ms
Stdev: 13.303 ms (7.1%)
Runs: 163 163 165 169 173 176 178 178 182 185 186 186 187 189 190 191 192 193 194 194 194 195 199 200 201 203 205 207 207 214

Current
Mean: 201.813 ms
Stdev: 20.974 ms (10.4%)
Runs: 166 167 173 175 176 178 180 190 190 191 193 193 193 196 199 201 202 203 204 208 209 210 210 214 216 218 220 221 236 237 239 250
App start nativeLaunch Baseline
Mean: 19.966 ms
Stdev: 2.042 ms (10.2%)
Runs: 18 18 18 18 18 18 18 18 19 19 19 19 19 19 20 20 20 20 20 20 20 21 21 21 21 23 23 25 26

Current
Mean: 20.200 ms
Stdev: 2.227 ms (11.0%)
Runs: 17 17 18 18 18 18 18 18 19 19 19 19 20 20 20 20 20 20 20 21 21 21 21 21 22 23 23 24 25 26
App start regularAppStart Baseline
Mean: 0.013 ms
Stdev: 0.001 ms (6.3%)
Runs: 0.011718999594449997 0.011962000280618668 0.012085000053048134 0.012531999498605728 0.012614000588655472 0.012736000120639801 0.012776000425219536 0.012899000197649002 0.012939000502228737 0.013062000274658203 0.013183999806642532 0.013224000111222267 0.013265000656247139 0.013265000656247139 0.013304999098181725 0.013387000188231468 0.01342800073325634 0.013467999175190926 0.013469001278281212 0.013671999797224998 0.013752998784184456 0.013833999633789062 0.013833999633789062 0.014037998393177986 0.014038000255823135 0.01411999948322773 0.014159999787807465 0.014241000637412071 0.015420999377965927 0.015502998605370522

Current
Mean: 0.014 ms
Stdev: 0.001 ms (4.5%)
Runs: 0.013102000579237938 0.013182999566197395 0.013467999175190926 0.013631001114845276 0.01371300034224987 0.013996999710798264 0.014038000255823135 0.014119001105427742 0.014281999319791794 0.014282001182436943 0.014282001182436943 0.014322999864816666 0.014363998547196388 0.014404000714421272 0.014444999396800995 0.014444999396800995 0.014445001259446144 0.014526000246405602 0.014566998928785324 0.014728998765349388 0.014730000868439674 0.014770999550819397 0.014770999550819397 0.014893000945448875 0.014973999932408333 0.01505500078201294 0.015298999845981598 0.01574699953198433 0.015992000699043274

@github-actions github-actions bot added the DeployBlockerCash This issue or pull request should block deployment label Feb 28, 2023
@github-actions
Copy link
Contributor

@Expensify/mobile-deployers 📣 Please look into this performance regression as it's a deploy blocker.

@sobitneupane
Copy link
Contributor

The change is not related to Open Search Page. So, it must be false alarm.

@OSBotify
Copy link
Contributor

OSBotify commented Mar 2, 2023

🚀 Deployed to staging by https://github.com/roryabraham in version: 1.2.78-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

OSBotify commented Mar 6, 2023

🚀 Deployed to production by https://github.com/mountiny in version: 1.2.78-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DeployBlockerCash This issue or pull request should block deployment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants