App icon indicating copy to clipboard operation
App copied to clipboard

[$500] mWeb - Request Money- Missing cursor when requesting/split the money

Open kavimuru opened this issue 3 years ago โ€ข 53 comments

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


Issue found when executing #10147

Action Performed:

  1. Go to staging.new.expensify.com
  2. Log in with any account
  3. Click FAB > Request Money
  4. Enter an amount
  5. Move cursor to the middle of the amount 5.1. Enter a Digit 5.2. Delete a digit 5.3. Paste a couple of digits 5.4. Cut a couple of digits

Expected Result:

Cursor should be present when requesting/split the money

Actual Result:

Missing cursor when requesting/split the money

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • Mobile Web (Android)

Version Number: 1.1.94.4 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos:

https://user-images.githubusercontent.com/43996225/187492774-2cd40f6e-7598-42eb-8fc5-b004ebea5cba.mp4

Expensify/Expensify Issue URL: Issue reported by: Applause internal team Slack conversation:

View all open jobs on GitHub

kavimuru avatar Aug 30 '22 16:08 kavimuru

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

melvin-bot[bot] avatar Aug 30 '22 16:08 melvin-bot[bot]

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

melvin-bot[bot] avatar Aug 31 '22 08:08 melvin-bot[bot]

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

melvin-bot[bot] avatar Aug 31 '22 08:08 melvin-bot[bot]

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

melvin-bot[bot] avatar Aug 31 '22 08:08 melvin-bot[bot]

This is a regression from https://github.com/Expensify/App/issues/6154 - I believe @eVoloshchak should fix this.

AndrewGable avatar Aug 31 '22 08:08 AndrewGable

@AndrewGable not really. This issue was present before the PR

I looked into solving it during 6154 PR, and i believe a fix for it is out of scope of the PR

rushatgabhane avatar Aug 31 '22 08:08 rushatgabhane

I'm also a bit confused by the steps in the OP versus the video. Something isn't clear, because I can see the cursor in the video? ๐Ÿ˜•

I also can't seem to reproduce it, if that's the problem as stated.

https://user-images.githubusercontent.com/16232057/187634101-d693cf6d-c642-41b7-9c18-f9cf7ceefe83.MP4

trjExpensify avatar Aug 31 '22 08:08 trjExpensify

@trjExpensify I think this is a mWeb - Android only issue

rushatgabhane avatar Aug 31 '22 17:08 rushatgabhane

Oh, I see. @kavimuru can you confirm that, please?

trjExpensify avatar Aug 31 '22 18:08 trjExpensify

@trjExpensify Correct, mWeb - Andriod

kbecciv avatar Sep 01 '22 03:09 kbecciv

Cool, thanks for clarifying.

trjExpensify avatar Sep 02 '22 15:09 trjExpensify

Proposal

Problem

The textbox is losing focus when number pad is pressed.

Solution

You should pass the method focusTextInput to the number pad and use it when onPress event occurs

src/pages/iou/steps/IOUAmountPage.js

...
<BigNumberPad
    numberPressed={this.updateAmountNumberPad}
    longPressHandlerStateChanged={state => this.shouldUpdateSelection = !state}
+   focusTextInput={this.focusTextInput}
/>
...

src/components/BigNumberPad.js

...
<Button
    ...
+   onPress={() => {
+       this.props.focusTextInput()
        this.props.numberPressed(column);
+   }}
    ...
/>
...

vinicius-grandi avatar Sep 02 '22 19:09 vinicius-grandi

The textbox is losing focus when number pad is pressed

@vinicius-grandi can we make it not loose the focus in the first place?

rushatgabhane avatar Sep 05 '22 17:09 rushatgabhane

The textbox is losing focus when number pad is pressed

@vinicius-grandi can we make it not loose the focus in the first place?

Proposal

Just use preventDefault on pressOut event (which would normally cause focus on button). The side effect is that prevents the click event as well, so to solve this, fire click event manually.

src/components/BigNumberPad.js

<Button 
...
    onPressOut={(e) => {
+     e.preventDefault();
+     e.target.click();
      clearInterval(this.state.timer);
      ControlSelection.unblock();
      this.props.longPressHandlerStateChanged(false);
    }}
...
/>
...

vinicius-grandi avatar Sep 06 '22 21:09 vinicius-grandi

@vinicius-grandi i don't think native platforms have a click() function

rushatgabhane avatar Sep 07 '22 17:09 rushatgabhane

Proposal

RCA: In web, focused input is blurred as default when click (mouse down) other elements.

Solution: When click number pad, prevent web's default behavior of mouse down event. This doesn't affect other callbacks of Pressable component (i.e. onPress, onLongPress, onPressIn, onPressOut)

Code proposal:

  • Introduce onMouseDown prop on Button component (Adding to propTypes, defaultProps can be done when create PR) https://github.com/Expensify/App/blob/a0340070ebf94fe3acde872c8c0c4222edd984c3/src/components/Button.js#L233-L258
                onMouseDown={this.props.onMouseDown}
  • Add onMouseDown callback on Button component of BigNumberPad

https://github.com/Expensify/App/blob/a0340070ebf94fe3acde872c8c0c4222edd984c3/src/components/BigNumberPad.js#L68-L81

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

This solution is only for web/mWeb and affects nothing on native iOS/Android platforms because onMouseDown callback is only for web.

aimane-chnaif avatar Sep 14 '22 06:09 aimane-chnaif

because onMouseDown callback is only for web.

wait, how is this being taken care of? @aimane-chnaif

rushatgabhane avatar Sep 14 '22 17:09 rushatgabhane

wait, how is this being taken care of? @aimane-chnaif

onMouseDown is web only property, not exist in native mobile. This is already used in the app as an important feature: send button on composer (https://github.com/Expensify/App/blob/main/src/pages/home/report/ReportActionCompose.js#L667) reference: https://github.com/Expensify/App/issues/7798 (PR)

aimane-chnaif avatar Sep 14 '22 17:09 aimane-chnaif

@aimane-chnaif your proposal looks great!

cc: @thienlnam C+ reviewed ๐ŸŽ€ ๐Ÿ‘€ ๐ŸŽ€

rushatgabhane avatar Sep 15 '22 21:09 rushatgabhane

@rushatgabhane, @thienlnam, @adelekennedy Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Sep 19 '22 06:09 melvin-bot[bot]

@thienlnam thoughts on the proposal above?

adelekennedy avatar Sep 19 '22 16:09 adelekennedy

Sorry, just got back from OOO

@rushatgabhane Did you have a chance to test those changes locally? The proposal looks good but want to make sure it doesn't impact other button places this is used

thienlnam avatar Sep 19 '22 23:09 thienlnam

โš ๏ธ Looks like this issue was linked to a possible regression on PRODUCTION here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a production regression has occurred a Root Cause Analysis is required. Please follow the instructions here.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

melvin-bot[bot] avatar Sep 20 '22 21:09 melvin-bot[bot]

There seem to be a few cursor issues that are related - the fix should encapsulate these issues

https://github.com/Expensify/App/issues/11095

thienlnam avatar Sep 20 '22 21:09 thienlnam

โš ๏ธ Looks like this issue was linked to a possible regression on PRODUCTION here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a production regression has occurred a Root Cause Analysis is required. Please follow the instructions here.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

melvin-bot[bot] avatar Sep 21 '22 03:09 melvin-bot[bot]

Pending proposal review in https://github.com/Expensify/App/issues/11095

thienlnam avatar Oct 03 '22 07:10 thienlnam

@thienlnam, should this issue be on hold for that one then?

trjExpensify avatar Oct 03 '22 12:10 trjExpensify

Reviewed the other issue https://github.com/Expensify/App/issues/11095. I think may be another regression from https://github.com/Expensify/App/pull/10147 or a missed test case during the review.

But the reprodcution of this issue is not covered in https://github.com/Expensify/App/issues/11095.

parasharrajat avatar Oct 04 '22 14:10 parasharrajat

โš ๏ธ Looks like this issue was linked to a possible regression on PRODUCTION here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a production regression has occurred a Root Cause Analysis is required. Please follow the instructions here.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

melvin-bot[bot] avatar Oct 04 '22 19:10 melvin-bot[bot]