You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2023-09-12] [HOLD for payment 2023-09-11] [$500] Request money - Enter key does not move to next page on big number pad page #26588
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open StagingDeployCash deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Please re-state the problem that we are trying to solve in this issue.
Request money - Enter key does nothing on Manual request amount input page
What is the root cause of that problem?
This came from 5b8cd86 where pressOnEnter prop is added to DistanceRequest. cc: @hayata-suenaga
Then why does this happen?
We render all tabs on Request money page in the order of left > right.
So Distance tab page is rendered after Manual tab page render.
So Button's enter key is subscribed in MoneyRequestAmountForm first. And then DistanceRequest next.
So when user press Enter key, DistanceRequest's button onPress takes precedence over MoneyRequestAmountForm's button.
What changes do you think we should make in order to solve the problem?
Step 1. set pressOnEnter prop value conditionally based on page active status.
Step 2. Update Button component to dynamically subscribe/unsubscribe enter key listener based on pressOnEnter prop change.
This logic will be added in componentDidUpdate
What alternative solutions did you explore? (Optional)
remove pressOnEnter prop from DistanceRequest's button
Currently, this listener is only established during the componentDidMount lifecycle. This issue primarily occurs on the "New Request Money" page because the text field starts empty, causing the isDisabled property to be initially set to true, and subsequently to false as the user inputs data. However, the Button component does not respond to this change in isDisabled during the componentDidUpdate lifecycle, preventing the Enter key event from being properly handled.
It's worth noting that this issue is observed in the development environment but is not likely a regression of commit, as the behavior of the Button component may be expected.
What changes do you think we should make in order to solve the problem?
To resolve this issue, I recommend adding the same logic for setting up the Enter key listener in the componentDidUpdate lifecycle when isDisabled changes. This modification ensures consistent behavior regardless of the initial state of isDisabled.
@mkhutornyi I think your solution sounds good and I would prefer it over @napster125 proposed way as we dont want to mess with Button component logic right now give its such heavily used component.
Can you describe how you gonna get the isActiveTab?
remove pressOnEnter prop from DistanceRequest's button
this will make it work for other pages, but then it does not work on the Distance request page.
I think I will just remove the pressOnEnter now because I am not sure if its trivial to get the tab index. I think we can live without the Enter working on the distance given it will be mainly used on mobile.
Activity
OSBotify commentedon Sep 2, 2023
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open
StagingDeployCashdeploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:melvin-bot commentedon Sep 2, 2023
Triggered auto assignment to @marcaaron (
Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.melvin-bot commentedon Sep 3, 2023
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
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.
mkhutornyi commentedon Sep 3, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Request money - Enter key does nothing on Manual request amount input page
What is the root cause of that problem?
This came from 5b8cd86 where
pressOnEnterprop is added to DistanceRequest. cc: @hayata-suenagaThen why does this happen?
We render all tabs on Request money page in the order of left > right.
So Distance tab page is rendered after Manual tab page render.
So Button's enter key is subscribed in MoneyRequestAmountForm first. And then DistanceRequest next.
So when user press Enter key, DistanceRequest's button onPress takes precedence over MoneyRequestAmountForm's button.
What changes do you think we should make in order to solve the problem?
Step 1. set
pressOnEnterprop value conditionally based on page active status.Step 2. Update Button component to dynamically subscribe/unsubscribe enter key listener based on
pressOnEnterprop change.This logic will be added in
componentDidUpdateWhat alternative solutions did you explore? (Optional)
remove
pressOnEnterprop from DistanceRequest's buttonnapster125 commentedon Sep 3, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Request money - Enter key does not move to next page on new money request page.
What is the root cause of that problem?
The root cause of this problem lies within the Button component, specifically in the way the Enter key listener is set up.
App/src/components/Button/index.js
Lines 167 to 190 in 52b1e3e
Currently, this listener is only established during the
componentDidMountlifecycle. This issue primarily occurs on the "New Request Money" page because the text field starts empty, causing theisDisabledproperty to be initially set to true, and subsequently to false as the user inputs data. However, the Button component does not respond to this change inisDisabledduring thecomponentDidUpdatelifecycle, preventing the Enter key event from being properly handled.It's worth noting that this issue is observed in the development environment but is not likely a regression of commit, as the behavior of the Button component may be expected.
What changes do you think we should make in order to solve the problem?
To resolve this issue, I recommend adding the same logic for setting up the Enter key listener in the
componentDidUpdatelifecycle whenisDisabledchanges. This modification ensures consistent behavior regardless of the initial state ofisDisabled.What alternative solutions did you explore? (Optional)
n/a
Result
6.mp4
mountiny commentedon Sep 3, 2023
@mkhutornyi I think your solution sounds good and I would prefer it over @napster125 proposed way as we dont want to mess with
Buttoncomponent logic right now give its such heavily used component.Can you describe how you gonna get the isActiveTab?
this will make it work for other pages, but then it does not work on the Distance request page.
mountiny commentedon Sep 3, 2023
I think I will just remove the pressOnEnter now because I am not sure if its trivial to get the tab index. I think we can live without the Enter working on the distance given it will be mainly used on mobile.
napster125 commentedon Sep 3, 2023
@mountiny it's impossible because this line will prevent the enter key event when isDisabled is true.
https://github.com/Expensify/App/blame/52b1e3e9abaabdaf79c0eeafef5665292cf2ab9c/src/components/Button/index.js#L178
73 remaining items
parasharrajat commentedon Sep 19, 2023
@mkhutornyi Reporting will be paid off when the issue is completely solved.
dylanexpensify commentedon Sep 22, 2023
@parasharrajat yes here!
mountiny commentedon Sep 25, 2023
I am confused whats he status on this one, can we close it out?
b4s36t4 commentedon Sep 25, 2023
@mountiny I think you can close this as there's another issue created for tracking the main issue. #28022
mountiny commentedon Sep 25, 2023
thanks! Feel free to reopen if closing is not the best path forwards
parasharrajat commentedon Oct 8, 2023
Payment requested as per #26588 (comment) #26588 (comment)
@dylanexpensify Can you post the payment summary here? Thanks.
dylanexpensify commentedon Oct 9, 2023
Payment summary:
JmillsExpensify commentedon Oct 9, 2023
$500 payment approved for @parasharrajat based on BZ summary.
mkhutornyi commentedon Oct 11, 2023
Am I eligible for any compensation here? As my proposal (correct root cause and alternative solution) might have helped fixing this deploy blocker.
Off topic:
@parasharrajat gave 👎 on my main solution but unfortunately his solution of allowing bubble caused another regression - #29051, while mine wouldn't have caused.
parasharrajat commentedon Oct 11, 2023
@mkhutornyi You are eligible on #28022 as discussed before.