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

[WAITING ON EUGENE] [$1000] Cursor jumps to next position when we use ',' in request money when language is English (or if using '.' in Spanish) #23933

Closed
1 of 6 tasks
kavimuru opened this issue Jul 31, 2023 · 45 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Jul 31, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Open the app
  2. Ensure that app language is English
  3. Click on plus and click on request money / split bill
  4. Add any amount, try to insert ',' (comma) in 2nd last or 3rd last position, app doesn't insert a cursor but jumps positions
  5. Try to insert any other symbol like '=,+,|,?' in 2nd last or 3rd last position and app won't allow the symbol to insert but will keep the cursor position same
  6. Switch to Spanish language mode.
  7. Try to insert '.' (period) in 2nd last or 3rd last position and observe that app will jump the cursor one position ahead every time if the language is set to Spanish

Expected Result:

App should not change cursor position when we try to insert ',' in amount for English language OR '.' in amount for Spanish language in request money / split bill

Actual Result:

App changes cursor position when we try to insert ',' in amount for English language OR '.' in amount for Spanish language in request money / split bill

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.47-3
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

cursor.position.jump.on.fullstop.or.comma.mp4
Recording.1412.mp4

Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1690268210124929

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01b976c4c3347bca34
  • Upwork Job ID: 1686553611490000896
  • Last Price Increase: 2023-08-09
  • Automatic offers:
    • samh-nl | Contributor | 26109224
    • dhanashree-sawant | Reporter | 26109226
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 31, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 31, 2023

Triggered auto assignment to @jliexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jul 31, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@kavimuru kavimuru changed the title Cursor jumps to next position when we use ',' in request money when language is english Cursor jumps to next position when we use ',' in request money when language is English Jul 31, 2023
@samh-nl
Copy link
Contributor

samh-nl commented Jul 31, 2023

Proposal

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

Cursor jumps to next position when we use ',' in request money when language is English

What is the root cause of that problem?

We are updating the cursor position using the non-comma stripped amount and subsequently strip the comma from the amount.
Therefore, the new cursor position is based on the incorrect (longer) value, leading it to jump to the next position.

setAmount((prevAmount) => {
setSelection((prevSelection) => getNewSelection(prevSelection, prevAmount.length, newAmountWithoutSpaces.length));
return stripCommaFromAmount(newAmountWithoutSpaces);
});

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

We should use the stripped amount for updating the cursor position, e.g.:

...
const strippedAmount = stripCommaFromAmount(newAmountWithoutSpaces);
setSelection((prevSelection) => getNewSelection(prevSelection, prevAmount.length, strippedAmount.length));
return strippedAmount;
...

This also fixes it for the Spanish scenario.

What alternative solutions did you explore? (Optional)

Ignoring event default behavior if the key is pressed, however this would require adding an extra handler.

@jliexpensify
Copy link
Contributor

@kavimuru can you re-test on v1.3.48-0? I can't seem to enter a comma when requesting money or splitting a bill.

@jliexpensify jliexpensify changed the title Cursor jumps to next position when we use ',' in request money when language is English [WAITING ON KAVI] Cursor jumps to next position when we use ',' in request money when language is English Aug 1, 2023
@samh-nl
Copy link
Contributor

samh-nl commented Aug 1, 2023

@jliexpensify I've reproduced it on staging (v1.3.48-0). There are constraints to this bug, for example the cursor must not be placed at the beginning of the amount.

@jliexpensify
Copy link
Contributor

jliexpensify commented Aug 1, 2023

@samh-nl can you share a video? I can't get a cursor to show at all on my end :(

I'm on v1.3.48-4

@kavimuru
Copy link
Author

kavimuru commented Aug 2, 2023

@jliexpensify Here is the video.

Recording.1425.mp4

@jliexpensify jliexpensify changed the title [WAITING ON KAVI] Cursor jumps to next position when we use ',' in request money when language is English Cursor jumps to next position when we use ',' in request money when language is English Aug 2, 2023
@jliexpensify
Copy link
Contributor

Thanks, that video helps - I've edited the GH issue and can repro.

@jliexpensify jliexpensify changed the title Cursor jumps to next position when we use ',' in request money when language is English Cursor jumps to next position when we use ',' in request money when language is English (or if using '.' in Spanish) Aug 2, 2023
@jliexpensify jliexpensify added the External Added to denote the issue can be worked on by a contributor label Aug 2, 2023
@melvin-bot melvin-bot bot changed the title Cursor jumps to next position when we use ',' in request money when language is English (or if using '.' in Spanish) [$1000] Cursor jumps to next position when we use ',' in request money when language is English (or if using '.' in Spanish) Aug 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 2, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01b976c4c3347bca34

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 2, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 2, 2023

Current assignee @jliexpensify is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Aug 2, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 2, 2023

📣 @servesh-chaturvedi! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@melvin-bot
Copy link

melvin-bot bot commented Aug 2, 2023

📣 @Surojd! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@Surojd
Copy link

Surojd commented Aug 2, 2023

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/surojd

@melvin-bot
Copy link

melvin-bot bot commented Aug 2, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@Surojd
Copy link

Surojd commented Aug 2, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.
Cursor jumps to next position when we use ',' in request money when language is English (or if using '.' in Spanish)

What is the root cause of that problem?

The non-comma-stripped amount is used to update the cursor location before the comma is removed.
Because of this, the new cursor location is determined by the wrong (longer) value, causing it to advance to the following point.

[App/src/pages/iou/steps/MoneyRequestAmountPage.js](https://github.com/Expensify/App/src/pages/iou/steps/MoneyRequestAmountPage.js#L315-L318


 setAmount((prevAmount) => { 
     setSelection((prevSelection) => getNewSelection(prevSelection, prevAmount.length, newAmountWithoutSpaces.length)); 
     return stripCommaFromAmount(newAmountWithoutSpaces); 
 }); 

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

We should use the stripped amount for updating the cursor position, e.g.:

 const strippedAmount = stripCommaFromAmount(newAmountWithoutSpaces);
setSelection((prevSelection) => getNewSelection(prevSelection, prevAmount.length, strippedAmount.length));
return strippedAmount;
 

This also fixes it for the Spanish scenario.

What alternative solutions did you explore? (Optional)

N/A

Proof Video

02.08.2023_10.24.48_REC.mp4

@Crystalian0322
Copy link

Crystalian0322 commented Aug 3, 2023

Proposal
Please re-state the problem that we are trying to solve in this issue.
Cursor jumps to next position when we use ',' in request money when language is English
https://github.com/Expensify/App/blob/ac49271c4009af1555f2513a11a7313831ae1961/src/pages/ReportDetailsPage.js#L18C1-L23C47
What is the root cause of that problem?
We are updating the cursor position using the non-comma stripped amount and subsequently strip the comma from the amount.
Therefore, the new cursor position is based on the incorrect (longer) value, leading it to jump to the next position.

https://github.com/Expensify/App/blob/157abce51a8ba4c1b7a82a596dcc6686b82be76d/src/pages/home/ReportScreen.js#L10C1-L19C3

What changes do you think we should make in order to solve the problem?
We should use the stripped amount for updating the cursor position, e.g.:

...
const strippedAmount = stripCommaFromAmount(newAmountWithoutSpaces);
setSelection((prevSelection) => getNewSelection(prevSelection, prevAmount.length, strippedAmount.length));
return strippedAmount;
...
This also fixes it for the Spanish scenario.

What alternative solutions did you explore? (Optional)
Ignoring event default behavior if the key is pressed, however this would require adding an extra handler.

@melvin-bot melvin-bot bot added the Overdue label Aug 4, 2023
@jliexpensify
Copy link
Contributor

Bump @0xmiroslav - there are a few proposals to review!

@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

@danieldoglas @eVoloshchak @jliexpensify @samh-nl this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!

@danieldoglas
Copy link
Contributor

What would you recommend for testing mobile, use the keys present on the number pad?

If in mobile we can't see those, it's ok to show just our custom number pad and that it works normally.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 21, 2023
@samh-nl
Copy link
Contributor

samh-nl commented Aug 21, 2023

PR is ready for review: #25624

@melvin-bot
Copy link

melvin-bot bot commented Aug 24, 2023

Based on my calculations, the pull request did not get merged within 3 working days of assignment. Please, check out my computations here:

  • when @samh-nl got assigned: 2023-08-14 09:47:46 Z
  • when the PR got merged: 2023-08-24 22:21:15 UTC
  • days elapsed: 8

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 30, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Cursor jumps to next position when we use ',' in request money when language is English (or if using '.' in Spanish) [HOLD for payment 2023-09-06] [$1000] Cursor jumps to next position when we use ',' in request money when language is English (or if using '.' in Spanish) Aug 30, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.58-5 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 2023-09-06. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

For reference, here are some details about the assignees on this issue:

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

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:

  • [@eVoloshchak] The PR that introduced the bug has been identified. Link to the PR:
  • [@eVoloshchak] 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:
  • [@eVoloshchak] 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:
  • [@eVoloshchak] Determine if we should create a regression test for this bug.
  • [@eVoloshchak] 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.
  • [@jliexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Sep 5, 2023
@jliexpensify
Copy link
Contributor

Payment summary:

Upwork job

@eVoloshchak can you complete the checklist? Thanks!

@jliexpensify
Copy link
Contributor

Bumping @eVoloshchak to complete the checklist please!

@jliexpensify
Copy link
Contributor

Paid in Upoworks, job removed. @eVoloshchak friendly bump to complete the checklist before we issue you payment, thanks!

@jliexpensify jliexpensify changed the title [HOLD for payment 2023-09-06] [$1000] Cursor jumps to next position when we use ',' in request money when language is English (or if using '.' in Spanish) [WAITING ON EUGENE] [$1000] Cursor jumps to next position when we use ',' in request money when language is English (or if using '.' in Spanish) Sep 8, 2023
@eVoloshchak
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: Refactor/23149 money request page #23979
  • 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: https://github.com/Expensify/App/pull/23979/files#r1319408939
  • 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: It's a fairly simple bug, I don't think an additional discussion is necessary

@eVoloshchak
Copy link
Contributor

Regression Test Proposal

  1. Click on the FAB -> Request money
  2. Enter 10.00
  3. Move the cursor near the start
  4. Press comma and dot (web/desktop) or press the comma/dot in the number pad (mobile)
  5. Verify that the cursor does not move
  6. Go to Settings > Preferences > Language and change language to Spanish
  7. Click on the FAB
  8. Click on Request money
  9. Enter 10,00
  10. Move the cursor near the start
  11. Press comma and dot (web/desktop) or press the comma/dot in the number pad (mobile)
  12. Verify that the cursor does not move

Do we agree 👍 or 👎

@JmillsExpensify
Copy link

Reviewed the details for @eVoloshchak. $1,000 approved for payment via NewDot based on BZ summary.

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 Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

9 participants