App icon indicating copy to clipboard operation
App copied to clipboard

[HOLD for payment 2021-11-04] Request / Split money - Cursor autofocus not regained after changing the currency

Open kavimuru opened this issue 5 years ago • 36 comments

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. Launch the desktop app and login
  2. Click the + icon in LHN and choose either request or split money
  3. Click the currency and choose any other currency

Expected Result:

Cursor focus regained after selecting new currency to enter amount

Actual Result:

Cursor focus not regained to enter amount after changing currency

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number: 1.94.0-0 Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos:

https://user-images.githubusercontent.com/43996225/132248521-33d9d21e-bc3e-4e39-90c8-0c8d637b825f.mp4

Expensify/Expensify Issue URL:

View all open jobs on GitHub

Upwork job link: https://www.upwork.com/jobs/~01d3c372f3b04d62f4

kavimuru avatar Sep 06 '21 17:09 kavimuru

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

MelvinBot avatar Sep 06 '21 17:09 MelvinBot

Proposed Solution

We have to add code within src/pages/iou/steps/IOUAmountPage.js

At present we are focusing text input during component did mount as shown below.

https://github.com/Expensify/App/blob/8d9f663431e80f75516b17a0b4425c78b0a81249/src/pages/iou/steps/IOUAmountPage.js#L83-L92

Approach 1: Add component did update method. If currency code changed during component did update we will focus text input as under:

  componentDidUpdate(prevProps) {
      if (this.props.iou.selectedCurrencyCode !== prevProps.iou.selectedCurrencyCode) {
          InteractionManager.runAfterInteractions(() => {
              // Focus text input
              if (this.textInput) {
                  this.textInput.focus();
              }
          });
      }
  }

Approach 2: Refactor some code, create focusTextInput() function. So we can reuse it from componentDidMount() and componentDidUpdate() as under:

    constructor(props) {
        super(props);

        this.focusTextInput = this.focusTextInput.bind(this);    // ** add this code
       // ... existing code
    }

    componentDidMount() {
        this.focusTextInput();
    }

    componentDidUpdate(prevProps) {
        if (this.props.iou.selectedCurrencyCode !== prevProps.iou.selectedCurrencyCode) {
            this.focusTextInput();
        }
    }

    /**
     * Focus text input
     */
    focusTextInput() {
        // Component is not initialized or rerender due to navigation transitions
        // So wait until interactions are complete before trying to focus
        InteractionManager.runAfterInteractions(() => {
            if (this.textInput) {
                this.textInput.focus();
            }
        });
    }

Also I notice that this issue is for Web and Desktop, not within iOS. At present not tested on mobile web, and android so not sure about this.

Once code updated it works as shown under:

Web

https://user-images.githubusercontent.com/7823358/132363547-71b35483-c072-41ef-82e1-682da7979cb4.mov

Desktop

https://user-images.githubusercontent.com/7823358/132368310-ba921059-a9fa-4cf8-b913-f143ac332b83.mov

If this issue considered external and my solution accepted then kindly invite me on upwork. My upwork profile: https://www.upwork.com/freelancers/~01c718889ed7821f82

Thanks.

PrashantMangukiya avatar Sep 07 '21 15:09 PrashantMangukiya

Hi, I also found another issue for this text input in web version. This is different issue but related to text input on this page so I am sharing information here. So QA/Engineer team can create another issue If need to propagate further.

As we type certain number sometimes cursor disappears from text input. What I understood is that as we type certain character it grow text input width, so during that cursor disappear at certain character because different char have different width so sometimes glitch happen to grow the text input width. Not sure, just assume this could happen.

https://user-images.githubusercontent.com/7823358/132376327-ef83f68d-9ec4-45c1-b777-7aa0cbc5aa9d.mov

This behaviour I notice within web version only. Desktop is working fine. i.e. it retain cursor within text input all time as we type.

PrashantMangukiya avatar Sep 07 '21 16:09 PrashantMangukiya

@PrashantMangukiya I think the second solution you have to the problem is the easiest to follow.

I'll label this as External.

joelbettner avatar Sep 08 '21 17:09 joelbettner

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

MelvinBot avatar Sep 08 '21 17:09 MelvinBot

@joelbettner Thank you for review the proposed solution. I am wandering that if my solution accepted then who will offer me to submit proposal on upwork, because at present no one Assignees on this issue.

PrashantMangukiya avatar Sep 08 '21 18:09 PrashantMangukiya

@isagoico at present no one Assignees on this issue #5102. I am wandering that if my solution accepted then who will offer me to submit proposal on upwork etc.

PrashantMangukiya avatar Sep 08 '21 22:09 PrashantMangukiya

Issue reproducible during KI retests.

@joelbettner I see you unassigned @michaelhaxhiu here not sure if that was intended.

isagoico avatar Sep 13 '21 15:09 isagoico

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

MelvinBot avatar Sep 13 '21 19:09 MelvinBot

@PrashantMangukiya can you propose to work on this job in Upwork so that I can hire you? https://www.upwork.com/jobs/~01d3c372f3b04d62f4

michaelhaxhiu avatar Sep 15 '21 11:09 michaelhaxhiu

@michaelhaxhiu, Submitted proposal, Kindly accept it.

PrashantMangukiya avatar Sep 15 '21 11:09 PrashantMangukiya

Hired 👍. Feel free to start on your PR.

michaelhaxhiu avatar Sep 15 '21 12:09 michaelhaxhiu

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

MelvinBot avatar Sep 15 '21 12:09 MelvinBot

@michaelhaxhiu, Preparing for the pr now, I will submit soon. Thank you.

PrashantMangukiya avatar Sep 15 '21 12:09 PrashantMangukiya

Update: @PrashantMangukiya prepared the PR and now we are waiting on @pecanoro to review 👍

michaelhaxhiu avatar Sep 15 '21 18:09 michaelhaxhiu

Hi @PrashantMangukiya, I've placed this issue on hold as per this update, as we are prioritising issues related to a feature release scheduled for 9/24. As an apology for the delay, we will add a $100 bonus as a thank you for waiting.

kadiealexander avatar Sep 16 '21 03:09 kadiealexander

Issue reproducible during KI retests.

isagoico avatar Sep 20 '21 15:09 isagoico

Issue reproducible during KI retests.

isagoico avatar Sep 27 '21 15:09 isagoico

Issue reproducible during KI retests

isagoico avatar Oct 04 '21 15:10 isagoico

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

MelvinBot avatar Oct 07 '21 12:10 MelvinBot