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

Prevent layout shift caused by the AddressSearch dropdown #6116

Closed
luacmartins opened this issue Oct 29, 2021 · 13 comments
Closed

Prevent layout shift caused by the AddressSearch dropdown #6116

luacmartins opened this issue Oct 29, 2021 · 13 comments
Assignees
Labels
Engineering Improvement Item broken or needs improvement. Weekly KSv2

Comments

@luacmartins
Copy link
Contributor

luacmartins commented Oct 29, 2021

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. On NewDot, navigate to /bank-account/company
  2. In the address field, start typing an address.
  3. Notice that as the dropdown shows up, it shifts the entire form down.
layoutshift.mov

Expected Result:

The form shouldn't shift.

Actual Result:

The form shifts.

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround? Yes, layout only.

Platform:

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number:
Reproducible in staging?:
Reproducible in production?:
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL:
Issue reported by:
Slack conversation:

View all open jobs on GitHub

@luacmartins luacmartins added Engineering Weekly KSv2 Improvement Item broken or needs improvement. labels Oct 29, 2021
@luacmartins luacmartins self-assigned this Oct 29, 2021
@luacmartins
Copy link
Contributor Author

@Expensify/design is this something we should fix?

@shawnborton
Copy link
Contributor

Agree, the dropdown should be absolutely positioned on top of the other elements. Maybe we should even give it a bit of a shadow too to create some more visual separation as well.

@luacmartins
Copy link
Contributor Author

Thanks for confirming @shawnborton! I'm coming across an edge case when:

  1. The dropdown is too close to the bottom of the screen
    Screen Shot 2021-11-01 at 3 58 25 PM

  2. The input is inside a nested form.
    Screen Shot 2021-11-01 at 3 57 56 PM

The library we are using does not expose a way to limit the maximum number of results (so we always display 5 if there are enough matches). One suggestion that I have is to display the dropdown show above the input in those cases. Any thoughts here?
Screen Shot 2021-11-01 at 4 01 50 PM

@shawnborton
Copy link
Contributor

Displaying above is interesting - how might that look on mobile? Are we able to get the text input to be focused and scrolled directly above the keyboard so that there is ample room for the results?

@luacmartins
Copy link
Contributor Author

Hmm my suggestion might have issues with shorter forms. If the form is short there isn't enough room for the dropdown above the input and we can't scroll, so the view is either cut at the bottom or at the top. Here's an example:
Screen Shot 2021-11-01 at 6 15 08 PM
Screen Shot 2021-11-01 at 6 09 24 PM

Now I'm not too sure how to solve this one. Any ideas @shawnborton?

@shawnborton
Copy link
Contributor

Hmm the only thing I can think of is to always launch the form to the bottom of the input and try to scroll the input towards the top of the viewport as much as possible.

@luacmartins
Copy link
Contributor Author

Still not sure how to approach the edge cases here. I'm gonna try to come back to this one next week.

@luacmartins
Copy link
Contributor Author

Haven't made any progress here yet. I will try to look into it next week.

@MelvinBot MelvinBot removed the Overdue label Nov 19, 2021
@parasharrajat
Copy link
Member

I have a suggestion. 🐿️ 🤡

The issue with the approach we are exploring so far.

  • This just doesn't work for mobile.
  • This will not fit the mobile web (we don't know the resolution of the device). This becomes worse when the keyboard is Open.
  • There would be positioning challenges.

I think we should create a new screen for selecting the address and show the Address selector as it is on that screen.

  1. Show a read-only input in this form whose UI does not change.
  2. When a user clicks it, Open the new page with a single input on the top where the user can select the address and press enter.
  3. On Press of entering, he would come back to this screen and that read-only input would be filled with selected address.

@shawnborton
Copy link
Contributor

I like that idea, it reminds me of how Google Maps handles adding in addresses for directions.

@luacmartins
Copy link
Contributor Author

Sounds like a good idea! I'll do some more thinking on how to handle the manual address input solution we are implementing.

@luacmartins
Copy link
Contributor Author

I will try to carve out some time to work on this issue this week!

@MelvinBot MelvinBot removed the Overdue label Dec 7, 2021
@luacmartins
Copy link
Contributor Author

I actually discussed this 1:1 with @marcaaron. Since nothing is broken and the solution at hand is really involved and hard to maintain, we will just close this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Engineering Improvement Item broken or needs improvement. Weekly KSv2
Projects
None yet
Development

No branches or pull requests

4 participants