Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.56k stars 2.9k forks source link

[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 kavimuru closed 1 year ago

kavimuru commented 1 year ago

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. 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?

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

https://github.com/Expensify/App/assets/43996225/ad83a9fc-21f8-462b-a7da-025dfe9093ba

https://github.com/Expensify/App/assets/43996225/c0adb229-0aff-4663-8dec-02684e0998d1

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
melvin-bot[bot] commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

Bug0 Triage Checklist (Main S/O)

samh-nl commented 1 year ago

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.

https://github.com/Expensify/App/blob/0fb8709848136c8f6fb4b907b14e174b007ba13a/src/pages/iou/steps/MoneyRequestAmountPage.js#L315-L318

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 commented 1 year ago

@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.

samh-nl commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

@jliexpensify Here is the video.

https://github.com/Expensify/App/assets/43996225/e44cb2a1-9f50-48fc-b4fd-9b54a816388f

jliexpensify commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

πŸ“£ @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[bot] commented 1 year ago

πŸ“£ @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 commented 1 year ago

Contributor details Your Expensify account email: surojsmiling@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/surojd

melvin-bot[bot] commented 1 year ago

βœ… Contributor details stored successfully. Thank you for contributing to Expensify!

Surojd commented 1 year ago

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

https://github.com/Expensify/App/assets/10323306/02e7faeb-ff9c-47c4-be99-c5737dd5a09e

Crystalian0322 commented 1 year ago

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.

jliexpensify commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

jliexpensify commented 1 year ago

Going to reassign this one.

melvin-bot[bot] commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

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

jliexpensify commented 1 year ago

Hi @eVoloshchak - can you help us out here? I've just reassigned and you're the lucky C+, cheers!

eVoloshchak commented 1 year ago

@samh-nl's proposal was the first to correctly identify the root cause and propose a fix, looks good to me, I think we should proceed with it

πŸŽ€πŸ‘€πŸŽ€ C+ reviewed!

melvin-bot[bot] commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

πŸ“£ @eVoloshchak Please request via NewDot manual requests for the Reviewer role ($1000)

melvin-bot[bot] commented 1 year ago

πŸ“£ @samh-nl πŸŽ‰ 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[bot] commented 1 year ago

πŸ“£ @dhanashree-sawant πŸŽ‰ An offer has been automatically sent to your Upwork account for the Reporter role πŸŽ‰ Thanks for contributing to the Expensify app!

Offer link Upwork job

danieldoglas commented 1 year ago

@samh-nl assigned!

eVoloshchak commented 1 year ago

@samh-nl, could you open the PR when you have time? Thanks

samh-nl commented 1 year ago

@eVoloshchak I can submit the PR tomorrow. For mobile users we currently set disableKeyboard and show the custom number pad. What would you recommend for testing mobile, use the keys present on the number pad?

melvin-bot[bot] commented 1 year ago

@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!

melvin-bot[bot] commented 1 year ago

@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 commented 1 year ago

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.

samh-nl commented 1 year ago

PR is ready for review: https://github.com/Expensify/App/pull/25624

melvin-bot[bot] commented 1 year ago

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

On to the next one πŸš€

melvin-bot[bot] commented 1 year ago

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

melvin-bot[bot] commented 1 year ago

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

If no regressions arise, payment will be issued on 2023-09-06. :confetti_ball:

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.

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:

melvin-bot[bot] commented 1 year ago

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:

jliexpensify commented 1 year ago

Payment summary:

Upwork job

@eVoloshchak can you complete the checklist? Thanks!

jliexpensify commented 1 year ago

Bumping @eVoloshchak to complete the checklist please!

jliexpensify commented 1 year ago

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

eVoloshchak commented 1 year ago
eVoloshchak commented 1 year ago

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 commented 1 year ago

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