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-10-23] [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$1000] IOU - Selecting currency in BNP and pressing "CMD+ENTER" results in accidental redirection #23395
In the currency selection menu, press the "CMD+ENTER" key combination
Expected Result:
The modal window of currency selection should close and the user should get to the previous window of currency amount input with correctly selected currency
Actual Result:
The modal currency selection window closes and the user is redirected to a random chat
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Android / native
Android / Chrome
iOS / native
iOS / Safari
MacOS / Chrome
MacOS / Desktop
Version Number: 1.3.44.0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Please re-state the problem that we are trying to solve in this issue.
The existing issue lies in the currency selection functionality of the app. After selecting currency for a money request in a chat room, a combination of "CMD+ENTER" keys results in an unwanted redirection to a random chat room, instead of just closing the currency selection menu and returning to the previous window.
What is the root cause of that problem?
The cause of the problem appears to be tied to the handling of the "CMD+ENTER" key combination in the app. Currently, the event listener in the currency selection menu is not configured to properly handle this key combination, leading to the accidental redirection.
What changes do you think we should make in order to solve the problem?
Here's the proposed code modification to handle the "CMD+ENTER" key combination, prevent the default behavior (which is triggering the form submission) and close the currency selection modal:
functionCurrencySymbolButton(props){consthandleKeyDown=(event)=>{if(event.metaKey&&event.key==='Enter'){event.preventDefault();props.onCurrencyButtonPress();}};return(<Tooltiptext={props.translate('iOUCurrencySelection.selectCurrency')}><PressableWithoutFeedbackonPress={props.onCurrencyButtonPress}accessibilityLabel={props.translate('iOUCurrencySelection.selectCurrency')}accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON}onKeyDown={handleKeyDown}// Added the keydown event listener here>
...
What alternative solutions did you explore? (Optional)
The callback is executed twice due to a bug in react-native-key-command, where both Enter and CMD+Enter are processed for the CMD+Enter shortcut and executed. This is due to a missing check for the correct modifierFlags, which should also match in the case of no modifier flags present (i.e. just Enter) in the input, but expected in the listener.
@MitchExpensify Only pressing Enter does not trigger the event listening to CMD+Enter. It's when the combination is pressed that both are processed, leading to a double execution of the callback.
It's a general problem when listening to a combination of keys where modifiers are involved.
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.84-10 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2023-10-23. 🎊
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.
External issue reporter
Contributor that fixed the issue
Contributor+ that helped on the issue and/or PR
For reference, here are some details about the assignees on this issue:
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:
[@johnmlee101] The PR that introduced the bug has been identified. Link to the PR:
[@johnmlee101] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
[@johnmlee101] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
[@mollfpr / @samh-nl] Determine if we should create a regression test for this bug.
[@mollfpr / @samh-nl] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
[@MitchExpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
[@johnmlee101] The PR that introduced the bug has been identified. Link to the PR:
[@johnmlee101] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
There's also another PR in the E/App that causing the issue, because it got resolve before the fix in upstream merged.
[@johnmlee101] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
The regression step should be enough.
[@mollfpr / @samh-nl] Determine if we should create a regression test for this bug.
[@mollfpr / @samh-nl] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
Click on the FAB
Go to Request money
Click on the currency symbol to open the currency selector
Press CMD+Enter
Verify that the currency selector is closed, returning the user to the enter money amount page
Activity
melvin-bot commentedon Jul 22, 2023
Triggered auto assignment to @MitchExpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jul 22, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)rayane-d commentedon Jul 22, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
The existing issue lies in the currency selection functionality of the app. After selecting currency for a money request in a chat room, a combination of "CMD+ENTER" keys results in an unwanted redirection to a random chat room, instead of just closing the currency selection menu and returning to the previous window.
What is the root cause of that problem?
The cause of the problem appears to be tied to the handling of the "CMD+ENTER" key combination in the app. Currently, the event listener in the currency selection menu is not configured to properly handle this key combination, leading to the accidental redirection.
What changes do you think we should make in order to solve the problem?
To address this issue, we need to modify the code in the CurrencySymbolButton.js file.
App/src/components/CurrencySymbolButton.js
Lines 20 to 32 in b7d17e0
Here's the proposed code modification to handle the "CMD+ENTER" key combination, prevent the default behavior (which is triggering the form submission) and close the currency selection modal:
What alternative solutions did you explore? (Optional)
None.
samh-nl commentedon Jul 22, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Pressing CMD+Enter while selecting the currency closes the modal.
What is the root cause of that problem?
In the
BaseOptionsSelectorcomponent, CMD+Enter is subscribed to for selecting rows:App/src/components/OptionsSelector/BaseOptionsSelector.js
Lines 91 to 93 in b7d17e0
The callback is executed twice due to a bug in
react-native-key-command, where both Enter and CMD+Enter are processed for the CMD+Enter shortcut and executed. This is due to a missing check for the correctmodifierFlags, which should also match in the case of no modifier flags present (i.e. just Enter) in the input, but expected in the listener.https://github.com/Expensify/react-native-key-command/blob/5b093ed48c9bb90f047c7a3f1267e384298c1018/src/index.js#L96-L102
Subsequently,
confirmCurrencySelectionis called twice inIOUCurrencySelectionleading to a double navigation, therefore closing the modal.What changes do you think we should make in order to solve the problem?
We should ensure that the input modifiers are correctly checked in
react-native-key-command(this line):Instead of the two if-statements contained in this function, we can also simplify this by combining them to:
if (isInputMatched && isCommandMatched) {What alternative solutions did you explore? (Optional)
Alternatively, we can add a debounce time to prevent the callback from being executed twice.
MitchExpensify commentedon Jul 24, 2023
@mountiny buddy check on this keyboard command actually being a platform wide expectation the same as hitting "Enter" on its own
mountiny commentedon Jul 25, 2023
@MitchExpensify I am not sure about this one, seems like a niche edge case where I am not sure if we should worry about.
mountiny commentedon Jul 25, 2023
@azimgd from your experience, have we been catching such flows before?
samh-nl commentedon Jul 25, 2023
@MitchExpensify Only pressing Enter does not trigger the event listening to CMD+Enter. It's when the combination is pressed that both are processed, leading to a double execution of the callback.
It's a general problem when listening to a combination of keys where modifiers are involved.
mountiny commentedon Jul 25, 2023
Yeah so I think if we want to solve this it would have to be in general
samh-nl commentedon Jul 25, 2023
I traced it back to the
react-native-key-commandlibrary, feel free to read the details in my proposal above.MitchExpensify commentedon Jul 26, 2023
Ok cool, as long as we solve in general this seems worth fixing
104 remaining items
melvin-bot commentedon Oct 16, 2023
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.84-10 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2023-10-23. 🎊
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 commentedon Oct 16, 2023
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:
MitchExpensify commentedon Oct 18, 2023
Wow whats up Melvin! Is this actually being held for payment at this point?
mollfpr commentedon Oct 20, 2023
Expensify/react-native-key-command#5
There's also another PR in the E/App that causing the issue, because it got resolve before the fix in upstream merged.
The regression step should be enough.
MitchExpensify commentedon Oct 22, 2023
Mind helping me understand if the fix has been on prod for 7 days without regression @mollfpr? The Melvin updates are causing me doubt
mollfpr commentedon Oct 23, 2023
@MitchExpensify The PR is included in the production release: https://github.com/Expensify/App/releases/tag/1.3.83-11, which is on Oct 14th.
MitchExpensify commentedon Oct 25, 2023
Payment summary:
MitchExpensify commentedon Oct 25, 2023
Mind taking a peak at the BZ steps @johnmlee101 #23395 (comment) 👀
mollfpr commentedon Oct 25, 2023
@MitchExpensify I already have the Upwork contract.
MitchExpensify commentedon Oct 28, 2023
Paid and contracts ended!