Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Fix: Search results list closing issues - #1

Merged
NikkiWines merged 3 commits into
Expensify:masterfrom
parasharrajat:master
Jan 19, 2022
Merged

NikkiWines merged 3 commits into
Expensify:masterfrom
parasharrajat:master

Conversation

@parasharrajat

@parasharrajat parasharrajat commented Jan 13, 2022 •

Copy link
Copy Markdown
Member

cc: @NikkiWines
I am focusing on these issues for now

  1. Close the list when we click away (outside the address input and its list)
  2. Close the list as soon as you focus away from the last item on the list.
  3. Row is selected twice when using Tab navigation.

Issue Expensify/App#6235

screen-2022-01-13-054406_WVDEpzeq.mp4

How to test

  1. Copy the whole code of GooglePlacesAutocomplete.js.
  2. Relace node_modules/react-native-google-places-autocomplete/GooglePlacesAutocomplete.js with the copied code.
  3. Go to Bank Setup / Company Step.
  4. Search for Address.
  5. Follow the [HOLD for payment 2022-02-01] Pressing "Tab" key while the result list of AddressSearch is open leaves it open even after clicking outside App#6235 for more testing steps.

@parasharrajat

Copy link
Copy Markdown
Member Author

Also, please do test it on Native. I wasn't able to do it. I am not sure about how document.addEventListener will react on native. although, code execution will not reach that statement on native but still. Thank you.

@parasharrajat

Copy link
Copy Markdown
Member Author

@NikkiWines This is ready.

@NikkiWines NikkiWines left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@parasharrajat this looks pretty good and seems to work well. Can you include a video showing the behavior for the desktop app as well, please?

Comment thread GooglePlacesAutocomplete.js Outdated
setListViewDisplayed(false);
};

document.addEventListener('click', outsideClickHandler);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

NAB: but I've noticed for Expensify/App we tend to use mousedown instead of click for these kinds of event listeners.

Comment thread GooglePlacesAutocomplete.js Resolved
@parasharrajat

Copy link
Copy Markdown
Member Author

Sorry @NikkiWines but I am not able to test it on Desktop. The address list is not loading on the development server. I used the hack to test it on the web but the same is not working on the desktop. But I am 99% sure that it works for Desktop as well.

@NikkiWines NikkiWines left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry for the delay @parasharrajat - I was doing some digging into whether we could easily add the blue border for focused list elements.

Tested and this worked well on desktop as well:

Screen.Recording.2022-01-19.at.12.08.09.mov

Tested on iOS and got an error but also getting the same error when testing on master 🤔

VirtualizedLists should never be nested inside plain ScrollViews with the same orientation because it can break windowing and other functionality - use another VirtualizedList-backed container instead.

@NikkiWines NikkiWines left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Dig some digging and found out that people have experienced this before this PR (see this slack post) so I think we're good to go here.

Also looks like it's just a console error and you can still use the list functionality correctly

@NikkiWines
NikkiWines merged commit 3bbd17d into Expensify:master Jan 19, 2022
@roryabraham

Copy link
Copy Markdown

Hi 👋

It looks like we merged this change in a fork of our repo but didn't open a pull request from our fork to the upstream. Can we make sure we create an issue in the upstream (if there's not one already) and then open a PR? I'm happy to help with that but don't have all the context. I just know we don't want our fork to diverge from the upstream without making every effort possible to get our changes merged.

@roryabraham

Copy link
Copy Markdown

I went ahead and created a PR against the upstream from our fork: FaridSafi#799

@parasharrajat

Copy link
Copy Markdown
Member Author

Thanks, @roryabraham.

@jjcoffee

Copy link
Copy Markdown

Just noting that this ancient PR caused this issue where the address suggestions no longer show after clicking the "fix the errors" link. This happens because this PR always hides the list even though in this case the input is still in a focused state. More details in the proposal that fixes the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants