Skip to content

Fix the position of the TOS on the sign on page to be above the keyboard - #13529

Merged
jasperhuangg merged 7 commits into
mainfrom
tgolen-animated-keyboard
Dec 14, 2022
Merged

jasperhuangg merged 7 commits into
mainfrom
tgolen-animated-keyboard

Conversation

@tgolen

@tgolen tgolen commented Dec 12, 2022 •

Copy link
Copy Markdown
Contributor

Fixed Issues

$ #11277

Tests

Note: We decided in the GH issue that mobile web platforms simply cannot be supported with the keyboard avoiding behavior. For mobile web platforms, as long as the user can tap outside of the input to make it lose focus, and they can scroll the page to view the content behind the keyboard, then that is OK 👍

  1. Sign out
  2. Tap or click on the email input element on the sign-in form to give it focus
  3. (on mobile platforms) Verify the keyboard comes up
  4. (on mobile native, NOT mobile web platforms) Verify the TOS is visible above the keyboard
  5. (on mobile web, NOT mobile native platforms) Verify the page can be scrolled to view the TOS link
  6. Click or tap outside of the input so that it loses focus
  7. (on mobile platforms) Verify the keyboard is dismissed
  8. Enter an email and click next
  9. Repeat steps 2-6 on the password form
  • Verify that no errors appear in the JS console

Offline tests

Same as above.

Note: For offline mode, there is the "offline indicator" which adds extra items to the vertical height of the page. On the password form, this means that it pushes the TOS behind the keyboard again. This is OK 👍

Offline Screenshots

image

image

QA Steps

Same as above

  • 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:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • 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 was added in all src/languages/* files
    • 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 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
2022-12-13_08-34-15.mp4
Mobile Web - Chrome
2022-12-13_08-33-00.mp4
Mobile Web - Safari
2022-12-13_08-31-37.mp4
Desktop
2022-12-13_08-34-49.mp4
iOS
2022-12-13_08-30-51.mp4
Android
2022-12-13_08-32-23.mp4

@tgolen tgolen self-assigned this Dec 12, 2022
@jasperhuangg
jasperhuangg self-requested a review December 12, 2022 21:40
@jasperhuangg

Copy link
Copy Markdown
Contributor

Just adding myself for review here so I can keep this in my K2

@jasperhuangg

Copy link
Copy Markdown
Contributor

Hey @tgolen!

To try to get something with Mobile Safari, I experimented with the flex-shrink property, but since it's just an inverse of flex-grow, it suffers from the same problems as any other flex solution.

The Mobile Safari keyboard incorrectly adds extra space at the bottom of the screen, which doesn't affect the flex of any of the elements above it:

Screen Shot 2022-12-13 at 4 25 32 PM

I didn't spend too long on this as Shawn mentioned that the design of this page could change very soon.

@jasperhuangg

jasperhuangg commented Dec 13, 2022 •

Copy link
Copy Markdown
Contributor

The good news is that I was able to figure out some of the style issues you were experiencing on iOS Native. Instead of conditionally adding marginBottom to the View encompassing the TermsAndLicenses component, I simply pass that margin into the keyboardVerticalOffset prop. Everything seems to work great with this:

ios.native.mp4

Android still works exactly the same as before with this change (I'm assuming because using behavior="padding" on the KeyboardAvoidingView meant it wasn't having any effect on Android anyways):

Screen.Recording.2022-12-13.at.4.29.06.PM.mov

And the behavior on all other touchscreen keyboard platforms is unaffected.

@tgolen

tgolen commented Dec 13, 2022

Copy link
Copy Markdown
Contributor Author

Hey, that's a great find, thank you! I didn't know about that prop. It makes sense that Android wouldn't change because the KAV is a no-op for Android (it's just an empty fragment). I'll get this cleaned up today and ready for review.

@tgolen tgolen changed the title Play around with keyboard detection on iOS Fix the position of the TOS on the sign on page to be above the keyboard Dec 13, 2022
@tgolen
tgolen marked this pull request as ready for review December 13, 2022 15:53
@tgolen
tgolen requested a review from a team as a code owner December 13, 2022 15:53
@melvin-bot
melvin-bot Bot removed the request for review from a team December 13, 2022 15:53
@melvin-bot

melvin-bot Bot commented Dec 13, 2022

Copy link
Copy Markdown

@jasperhuangg @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]

@melvin-bot
melvin-bot Bot requested a review from sobitneupane December 13, 2022 15:53

@sobitneupane sobitneupane left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When offline some part of footer is cut-off in password page in Android Native.

Screen.Recording.2022-12-14.at.13.41.03.mov

@jasperhuangg

jasperhuangg commented Dec 14, 2022 •

Copy link
Copy Markdown
Contributor

@sobitneupane

I think that's okay, there's simply too many elements on the screen for it to fit, and the user can always scroll down a bit to view the rest of the text.

We run into similar issues on the password form on other platforms, and we've decided that it isn't worth fixing.

@sobitneupane

Copy link
Copy Markdown
Contributor

Screenshots/Videos

Web
Screen.Recording.2022-12-14.at.13.09.23.mov
Mobile Web - Chrome
Screen.Recording.2022-12-14.at.13.05.48.mov
Mobile Web - Safari
Screen.Recording.2022-12-14.at.13.20.23.mov
Desktop
Screen.Recording.2022-12-14.at.13.27.52.mov
iOS
Screen.Recording.2022-12-14.at.13.25.43.mov
Android
Screen.Recording.2022-12-14.at.13.03.59.mov

@sobitneupane

Copy link
Copy Markdown
Contributor

Lint error looks unrelated to this PR.

Merging with main might solve the issue according to https://expensify.slack.com/archives/C01GTK53T8Q/p1670954885116019

@jasperhuangg

Copy link
Copy Markdown
Contributor

@sobitneupane ahh beat me to it, I had already merged main before 😅

@sobitneupane sobitneupane left a comment

Copy link
Copy Markdown
Contributor

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:
    • iOS / native
    • Android / native
    • iOS / Safari
    • Android / Chrome
    • MacOS / Chrome
    • 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 was added in all src/languages/* files
    • 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 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 reviewer checklist, including those that don't apply to this PR.

@jasperhuangg
jasperhuangg merged commit 1bac1ea into main Dec 14, 2022
@jasperhuangg
jasperhuangg deleted the tgolen-animated-keyboard branch December 14, 2022 08:23
@OSBotify

Copy link
Copy Markdown
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
Copy Markdown
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
runJsBundle 172.414 ms → 184.188 ms (+11.774 ms, +6.8%)
TTI 779.897 ms → 783.032 ms (+3.135 ms, ±0.0%)
nativeLaunch 12.065 ms → 12.344 ms (+0.279 ms, +2.3%)
regularAppStart 0.014 ms → 0.014 ms (+0.000 ms, +1.8%)
Show details
Name Duration
runJsBundle Baseline
Mean: 172.414 ms
Stdev: 12.397 ms (7.2%)
Runs: 145 149 158 160 162 162 163 164 165 167 167 168 168 169 171 171 176 177 178 179 181 181 183 183 183 189 191 192 198

Current
Mean: 184.188 ms
Stdev: 22.230 ms (12.1%)
Runs: 157 161 162 162 162 165 167 168 168 168 168 171 173 173 174 174 175 176 180 183 186 186 191 196 206 206 207 216 222 225 231 235
TTI Baseline
Mean: 779.897 ms
Stdev: 34.592 ms (4.4%)
Runs: 734.904857000336 736.4332260005176 737.1504679992795 737.3208460006863 737.7514069993049 741.3220680002123 743.4170099999756 752.9978439994156 758.7020350005478 760.7342969998717 763.0617350004613 763.197227999568 767.267070999369 769.6387809999287 771.1012629996985 775.4968779999763 777.451751999557 779.5673210006207 785.5006099995226 788.8705540001392 792.8128389995545 796.0984680000693 796.863409999758 797.950964000076 799.562063999474 814.8548739999533 815.426183000207 829.2090179994702 834.6261299997568 841.6724870000035 875.8554200008512

Current
Mean: 783.032 ms
Stdev: 33.934 ms (4.3%)
Runs: 723.8912070002407 740.0921580009162 741.1518050003797 741.2915049996227 746.7089300006628 753.0627069994807 753.880612000823 756.2635549996048 756.3042709995061 759.7662339992821 764.3157839998603 767.1165440008044 768.1481989994645 769.0313239991665 769.2567490004003 780.2004649993032 790.0359949991107 791.5108209997416 792.3023070003837 792.7211429998279 794.7144530005753 794.7491900008172 796.2356439996511 798.2420070003718 804.5432530008256 820.0557870008051 826.2464049998671 833.1542750000954 843.4228210002184 849.0226780008525 856.5609419997782
nativeLaunch Baseline
Mean: 12.065 ms
Stdev: 2.758 ms (22.9%)
Runs: 8 9 9 9 9 9 10 10 11 11 11 11 11 11 11 11 11 12 12 12 12 12 13 14 14 15 16 17 17 17 19

Current
Mean: 12.344 ms
Stdev: 2.557 ms (20.7%)
Runs: 8 9 9 9 10 10 11 11 11 11 11 11 11 11 11 11 12 12 12 13 13 13 13 14 14 15 15 16 16 16 17 19
regularAppStart Baseline
Mean: 0.014 ms
Stdev: 0.001 ms (5.8%)
Runs: 0.012328999117016792 0.012450998649001122 0.012613998726010323 0.012736000120639801 0.012777000665664673 0.012777000665664673 0.01285800151526928 0.01314300112426281 0.013182999566197395 0.013224000111222267 0.01330600120127201 0.013508999720215797 0.01355000026524067 0.013630999252200127 0.013631999492645264 0.013712000101804733 0.013754000887274742 0.013793999329209328 0.013833999633789062 0.013875998556613922 0.013915998861193657 0.014038000255823135 0.014118999242782593 0.01411999948322773 0.014120001345872879 0.0143630001693964 0.014649000018835068 0.014688998460769653 0.014729999005794525 0.015461999922990799 0.01550300046801567

Current
Mean: 0.014 ms
Stdev: 0.001 ms (3.7%)
Runs: 0.012899000197649002 0.012939000502228737 0.012980001047253609 0.013224000111222267 0.013265000656247139 0.013468001037836075 0.013549000024795532 0.013712000101804733 0.013794001191854477 0.013874998316168785 0.013875000178813934 0.013876000419259071 0.0139979999512434 0.014037998393177986 0.014038000255823135 0.01407800056040287 0.014079000800848007 0.014161000028252602 0.014201000332832336 0.014240998774766922 0.014241000637412071 0.014242000877857208 0.014281999319791794 0.014323001727461815 0.01448499970138073 0.014527000486850739 0.014812000095844269 0.014934001490473747

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by @chiragsalian in version: 1.2.40-3 🚀

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants