[HOLD for payment 2021-11-04] Request / Split money - Cursor autofocus not regained after changing the currency
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:
- Launch the desktop app and login
- Click the + icon in LHN and choose either request or split money
- 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:
Upwork job link: https://www.upwork.com/jobs/~01d3c372f3b04d62f4
Triggered auto assignment to @joelbettner (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
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.
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 I think the second solution you have to the problem is the easiest to follow.
I'll label this as External.
Triggered auto assignment to @michaelhaxhiu (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.
@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.
@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.
Issue reproducible during KI retests.
@joelbettner I see you unassigned @michaelhaxhiu here not sure if that was intended.
Huh... This is 4 days overdue. Who can take care of this?
@PrashantMangukiya can you propose to work on this job in Upwork so that I can hire you? https://www.upwork.com/jobs/~01d3c372f3b04d62f4
@michaelhaxhiu, Submitted proposal, Kindly accept it.
Hired 👍. Feel free to start on your PR.
Triggered auto assignment to @pecanoro (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@michaelhaxhiu, Preparing for the pr now, I will submit soon. Thank you.
Update: @PrashantMangukiya prepared the PR and now we are waiting on @pecanoro to review 👍
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.
Issue reproducible during KI retests.
Issue reproducible during KI retests.
Issue reproducible during KI retests
Triggered auto assignment to @MitchExpensify (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.