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

[$250] Web - User has to click twice to select currency if the currency is around the bottom #41922

Closed
1 of 6 tasks
lanitochka17 opened this issue May 9, 2024 · 32 comments
Closed
1 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented May 9, 2024

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


Version Number: 1.4.72-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Click on FAB > Submit expense > Click on the currency to open the currency selector
  3. Click on a currency located around the bottom of the list

Expected Result:

The currency gets selected on the first click

Actual Result:

The currency does not get selected on the first click but moves up to be in the middle of the list

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6475853_1715257148330.bandicam_2024-05-09_11-09-33-903.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0151b3d12408cd70e1
  • Upwork Job ID: 1790583776832409600
  • Last Price Increase: 2024-05-15
  • Automatic offers:
    • jayeshmangwani | Reviewer | 0
    • tienifr | Contributor | 0
Issue OwnerCurrent Issue Owner: @jayeshmangwani
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 9, 2024
Copy link

melvin-bot bot commented May 9, 2024

Triggered auto assignment to @JmillsExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lanitochka17
Copy link
Author

@JmillsExpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@lanitochka17
Copy link
Author

We think that this bug might be related to #vip-vsp

@melvin-bot melvin-bot bot added the Overdue label May 13, 2024
Copy link

melvin-bot bot commented May 14, 2024

@JmillsExpensify Huh... This is 4 days overdue. Who can take care of this?

@JmillsExpensify JmillsExpensify added the External Added to denote the issue can be worked on by a contributor label May 15, 2024
@melvin-bot melvin-bot bot changed the title IOU - User has to click twice to select currency if the currency is around the bottom [$250] IOU - User has to click twice to select currency if the currency is around the bottom May 15, 2024
Copy link

melvin-bot bot commented May 15, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0151b3d12408cd70e1

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 15, 2024
Copy link

melvin-bot bot commented May 15, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @jayeshmangwani (External)

@melvin-bot melvin-bot bot removed the Overdue label May 15, 2024
@JmillsExpensify
Copy link

Added to #wave-collect and opened up for proposals.

@bernhardoj
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

When we hold down the list item, the list scrolls and the click is ignored.

What is the root cause of that problem?

When the item is focused either by keyboard or mouse, it will set the item as the focused index.

onFocus={() => setFocusedIndex(normalizedIndex)}

When the focused index changes, we scroll to the index.

onFocusedIndexChange: (index: number) => {
scrollToIndex(index, true);
},

And because we release the mouse after the list scrolls, the click isn't registered anymore.

What changes do you think we should make in order to solve the problem?

Don't scroll the list if it's focused by mouse. We can create a new ref called shouldScrollAfterFocus. Set it to false in the list item onMouseDown.

if (shouldPreventDefaultFocusOnSelectRow || isItemFocused) {
    return;
}
shouldScrollAfterFocus.current = false;

We ignore it if shouldPreventDefaultFocusOnSelectRow because the item won't receive focus and if the item is already focused.

Then return early here if shouldScrollAfterFocus is false.

onFocusedIndexChange: (index: number) => {
scrollToIndex(index, true);
},

if (!shouldScrollAfterFocus.current) {
    shouldScrollAfterFocus.current = true;
    return;
}

What alternative solutions did you explore? (Optional)

Set shouldPreventDefaultFocusOnSelectRow to true by default so the item can't receive focus by mouse.

@tienifr
Copy link
Contributor

tienifr commented May 15, 2024

Proposal

Please re-state the problem that we are trying to solve in this issue.

The currency does not get selected on the first click but moves up to be in the middle of the list

What is the root cause of that problem?

When the user long press on the row, it will trigger focus on the row, causing the focusIndex to change and the list will scroll to the row here.

After the scrolling happens and the user release the press, it no longer works because the mouse is no longer hovered above the row.

What changes do you think we should make in order to solve the problem?

When the user long press on the row, it will trigger focus on the row

This behavior is inconsistent with native platforms, on native when we press in, the row will not be focused automatically. I don't see any reason why we would want the row to gain focus after pressing, because the user will be navigated to another page after pressing the item. So we should not focus on the item when pressing, so it's consistent with native platforms' behavior.

To do this we can simply update this to

onMouseDown={(e) => e.preventDefault()}

What alternative solutions did you explore? (Optional)

If we want to make the row gain focus when it's pressed in web, we need to do the same for native platforms to be consistent. To do this we need to:

  1. In PressableWithFeedback here, listen to onPressIn and if shouldPreventDefaultFocusOnSelectRow is false:
  • set the focused index of the list to the item that's being pressed
  • set a ref enableScrollToFocusedIndex, to false to disable scrolling to focused index, we can also limit this setting to only when the item is not pressed
  1. In here, if enableScrollToFocusedIndex is false, set it to true and early return. So we won't be scrolling to the focused index in this case

@jayeshmangwani
Copy link
Contributor

I am trying to reproduce this issue on staging, but currency selection is working fine for me at the bottom of the list, @bernhardoj and @tienifr are you able to reproduce this issue consistently ?

currenncy-double-click.mov

@bernhardoj
Copy link
Contributor

@jayeshmangwani you need to hold down a bit before releasing the click/press

@tienifr
Copy link
Contributor

tienifr commented May 16, 2024

Yes @jayeshmangwani Please do a long press

@jayeshmangwani
Copy link
Contributor

Thanks for the help; now I can reproduce this

@kbecciv kbecciv changed the title [$250] IOU - User has to click twice to select currency if the currency is around the bottom [$250] Web - User has to click twice to select currency if the currency is around the bottom May 17, 2024
@jayeshmangwani
Copy link
Contributor

I also feel the same as @tienifr ; we should remove the conditional onMouseDown={shouldPreventDefaultFocusOnSelectRow ? (e) => e.preventDefault() : undefined} and instead we should use the onMouseDown={(e) => e.preventDefault()}, Conditional onMouseDown was added in this PR. Still, I am not sure why it was added conditional instead of directly passing the e.preventDefault() for all the onMouseDown; we can go with the @tienifr 's Proposal of using onMouseDown={(e) => e.preventDefault()}.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented May 20, 2024

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 20, 2024
Copy link

melvin-bot bot commented May 20, 2024

📣 @jayeshmangwani 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented May 20, 2024

📣 @tienifr 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer 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 📖

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels May 20, 2024
@tienifr
Copy link
Contributor

tienifr commented May 20, 2024

@jayeshmangwani PR #42380 is ready to review

@Julesssss

This comment was marked as outdated.

Copy link

melvin-bot bot commented Jun 12, 2024

This issue has not been updated in over 15 days. @JmillsExpensify, @Julesssss, @jayeshmangwani, @tienifr eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@melvin-bot melvin-bot bot added the Monthly KSv2 label Jun 12, 2024
@Julesssss
Copy link
Contributor

PR was just merged

@Julesssss Julesssss added Weekly KSv2 and removed Monthly KSv2 labels Jun 13, 2024
@jayeshmangwani
Copy link
Contributor

@JmillsExpensify PR Deployed to production 2 weeks ago. The issue is ready for payout

@JmillsExpensify
Copy link

Payment summary:

Both of you are eligible for NewDot payments. Should I cancel the Upwork contracts?

@jayeshmangwani
Copy link
Contributor

Both of you are eligible for NewDot payments. Should I cancel the Upwork contracts?

Yes 👍

@JmillsExpensify
Copy link

I'll assume the same for @tienifr. Btw, what about the checklist?

@mallenexpensify
Copy link
Contributor

Contributor: @tienifr due $250 via NewDot
Contributor+: @jayeshmangwani due $250 via NewDot.

@jayeshmangwani it looks like the checklist didn't populate. plz copy/paste the below. Thx

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@] The PR that introduced the bug has been identified. Link to the PR:
  • [@] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@] Determine if we should create a regression test for this bug.
  • [@] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@bz] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@JmillsExpensify
Copy link

Thanks @mallenexpensify! I'm closing this issue and will circle back for payments once I review the expenses in New Expensify. Don't forget the checklist please.

@jayeshmangwani
Copy link
Contributor

Regression Test Proposal

  1. Open the app.
  2. Click on the FAB -> Submit expense.
  3. Click on the currency to open the currency selector.
  4. Long press on a currency located near the bottom of the list.
  5. Verify that the currency gets selected after releasing the long press.

Do we agree 👍 or 👎

@jayeshmangwani
Copy link
Contributor

Requested $250 on NewDot

@JmillsExpensify
Copy link

$250 approved for @tienifr

@JmillsExpensify
Copy link

$250 approved for @jayeshmangwani

@mallenexpensify
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
Archived in project
Development

No branches or pull requests

7 participants