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

[HOLD for payment 2022-02-01] Pressing "Tab" key while the result list of AddressSearch is open leaves it open even after clicking outside #6235

Closed
aldo-expensify opened this issue Nov 5, 2021 · 65 comments · Fixed by #6345
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Engineering External Added to denote the issue can be worked on by a contributor Improvement Item broken or needs improvement. Reviewing Has a PR in review Weekly KSv2

Comments

@aldo-expensify
Copy link
Contributor

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. Type an address that yield results
  2. Press "Tab" key
  3. Click somewhere else in the form

Expected Result:

The list of results should close after clicking outside
Focused element of the list after pressing tab should be highlighted

Actual Result:

The list remains open event after focusing other inputs
No element of the list gets highlighted even if the focus changed to one of them after pressing tab

Screen.Recording.2021-11-04.at.8.44.53.PM.mov

Workaround:

The user can still close the list by focusing again on the AddressSearch input and clicking outside. Or the user can just ignore the opened list.

Platform:

Where is this issue occurring?

  • Web
  • Desktop App

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

@aldo-expensify aldo-expensify added AutoAssignerTriage Auto assign issues for triage to an available triage team member Daily KSv2 labels Nov 5, 2021
@MelvinBot
Copy link

Triggered auto assignment to @flaviadefaria (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

@MelvinBot MelvinBot removed the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Nov 5, 2021
@MelvinBot
Copy link

Triggered auto assignment to @Dal-Papa (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@flaviadefaria flaviadefaria added the Improvement Item broken or needs improvement. label Nov 5, 2021
@flaviadefaria flaviadefaria removed their assignment Nov 5, 2021
@Dal-Papa Dal-Papa added the External Added to denote the issue can be worked on by a contributor label Nov 5, 2021
@MelvinBot
Copy link

Triggered auto assignment to @kevinksullivan (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@MelvinBot
Copy link

@Dal-Papa, @kevinksullivan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@Dal-Papa
Copy link

Dal-Papa commented Nov 8, 2021

Chill @MelvinBot, it was the weekend and we just started a company offsite.

@MelvinBot MelvinBot removed the Overdue label Nov 8, 2021
@developvsn
Copy link
Contributor

developvsn commented Nov 10, 2021

In AddressSearch.js file we have to:

  1. Add here onKeyPress prop
    textInputProps={{
onKeyPress: (event) => {
                    if(event.code == 'Tab' && !isSelected){
                        googlePlacesRef.current.setAddressText("")
                    }
                },

to handle press "tab" button in input

  1. Add to AddressSearch component isSelected state variable with useState hook to check if user selected final address we will not clear input field but only will move to next input field.

    const AddressSearch = (props) => {

    const [isSelected, setIsSelected] = useState(true);

  2. Change this variable when user selects something from dropdown in onPress method of GooglePlacesAutocomplete Component:

    onPress={(data, details) => {
    saveLocationDetails(details);

onPress={(data, details) => {
saveLocationDetails(details);
                setIsSelected(true)

  1. Add onBlur method of GooglePlacesAutocomplete Component to make list of results close after clicking outside:
    <GooglePlacesAutocomplete
onBlur={() => {
                    if(!isSelected){
                        googlePlacesRef.current.setAddressText("")
                    }}}
Screen.Recording.2021-11-09.at.19.44.40-1.2.mov

@MelvinBot
Copy link

@Dal-Papa, @kevinksullivan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@kevinksullivan
Copy link
Contributor

@MelvinBot MelvinBot removed the Overdue label Nov 12, 2021
@botify botify removed the Daily KSv2 label Nov 12, 2021
@MelvinBot MelvinBot added Weekly KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors labels Nov 12, 2021
@MelvinBot
Copy link

Triggered auto assignment to @NikkiWines (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@NikkiWines
Copy link
Contributor

I think @developvsn's proposal looks good, though I think it'd be event.key if we're matching to Tab and not the keyCode 9.

@kevinksullivan can you hire @developvsn for this job? Thanks!

@kevinksullivan
Copy link
Contributor

All set!

@NikkiWines
Copy link
Contributor

@developvsn any update here?

@developvsn
Copy link
Contributor

@developvsn any update here?

Sorry, missed the previous message of yours. I'll take a look into that

@developvsn
Copy link
Contributor

developvsn commented Jan 12, 2022

@developvsn any update here?

@NikkiWines Unable to fix the issue because there are a lot of internal library bugs, like functions blur() and focus() that don’t work at all.

@parasharrajat had plans to find a solution, any thoughts?

@parasharrajat
Copy link
Member

I will look into it today.

@parasharrajat
Copy link
Member

parasharrajat commented Jan 13, 2022

I am pretty sure we won't be able to contribute back to the main lib
image


Finally got time to work on this and I have a solution ready, video ⬇️ . Let me know what is next step? @NikkiWines
Changes would be done to GooglePlacesAutocomplete lib.

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.
screen-2022-01-13-054406_WVDEpzeq.mp4

@NikkiWines
Copy link
Contributor

Finally got time to work on this and I have a solution ready, video ⬇️ .

Nice! 🎉

Let me know what is next step? @NikkiWines. Changes would be done to GooglePlacesAutocomplete lib.

I think the next step would be to fork the lib and spin up a PR with your changes @parasharrajat

@parasharrajat
Copy link
Member

parasharrajat commented Jan 13, 2022

@NikkiWines Could you please fork it, I don't have privileges? I can send the PR.

Also please assign this issue to me. Thanks.

@MelvinBot
Copy link

📣 @parasharrajat You have been assigned to this job by @NikkiWines!
Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@NikkiWines NikkiWines removed the Reviewing Has a PR in review label Jan 13, 2022
@NikkiWines
Copy link
Contributor

Oh yep, sorry - I forgot we have to handle that internally. @parasharrajat, just to be clear, you mentioned theGooglePlacesAutocomplete lib, but the lib we're currently using is react-native-google-places-autocomplete. The repo we'd be forking is https://github.com/FaridSafi/react-native-google-places-autocomplete

@parasharrajat
Copy link
Member

Sorry for the confusion, I mean the same repo react-native-google-places-autocomplete. It has only one component GooglePlacesAutocomplete and I mentioned its name.

@NikkiWines
Copy link
Contributor

Should be all good now @parasharrajat - https://github.com/Expensify/react-native-google-places-autocomplete

@parasharrajat
Copy link
Member

Spinning up the PR. Thanks.

@parasharrajat
Copy link
Member

@NikkiWines NikkiWines added the Reviewing Has a PR in review label Jan 17, 2022
@parasharrajat
Copy link
Member

Leaving a note.
@kevinksullivan Based on this #7330 (comment), please hire me whenever ready.

@botify botify added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jan 25, 2022
@botify
Copy link

botify commented Jan 25, 2022

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.1.32-0 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2022-02-01. 🎊

@botify botify changed the title Pressing "Tab" key while the result list of AddressSearch is open leaves it open even after clicking outside [HOLD for payment 2022-02-01] Pressing "Tab" key while the result list of AddressSearch is open leaves it open even after clicking outside Jan 25, 2022
@kevinksullivan
Copy link
Contributor

Thanks @parasharrajat . Sent you an invite to the reposted job.

@parasharrajat
Copy link
Member

Ping for
Upwork

@kevinksullivan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Engineering External Added to denote the issue can be worked on by a contributor Improvement Item broken or needs improvement. Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants