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 2024-02-26] [$500] Cursor don't move to next line if return button tapped on keypad after back from referral #35373
Version Number: v1.4.33-3 Reproducible in staging?: y Reproducible in production?: y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Applause internal team Slack conversation:
Action Performed:
Tap on FAB button >> Start Chat
Click on "Start a Chat, get $250" referral banner
Go back to start chat
Search or select any user
Tap on compose box
Enter any message
Tap on return button on keypad
Expected Result:
After back from referral page, cursor in compose box should move to next line on tapping return button on keypad
Actual Result:
Cursor do not move to next line in compose box on tapping return button on keypad after back from referral page
Note: Issue reproducible on web with SHIFT+Enter & console error shows up (Please check web video attachment)
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
changed the title [-]Cursor don't move to next line if return button tapped on keypad after back from referral[/-][+][$500] Cursor don't move to next line if return button tapped on keypad after back from referral[/+]on Jan 30, 2024
Please re-state the problem that we are trying to solve in this issue.
Pressing shift enter doesn't add a new line.
What is the root cause of that problem?
From the error, we can see that the selectRow from BaseOptionsSelector is still called even after the page is closed, so this.textInput.isFocused() throws an error because the text input is null now. The reason selectRow is still called is because we have a hanging ENTER keyboard shortcut. This happens when we open the referral page, go back, and close the new chat page. Here is what happened:
We have a focusin listener to disable the enter shortcut whenever an element with a role that is other than PRESENTATION is focused, and enable it in focusout.
When we go back from the referral page, the page gains focus and focusout is also called. So, the enter shortcut is registered twice, but we can only have one instance of the shortcut to unsubscribe when the component unmount.
What changes do you think we should make in order to solve the problem?
It would be great if the component is migrated to func component so we can use useKeyboardShortcut hook and have a single place to either subscribe/unsubscribe the shortcut. But because we still use class component, we can always make sure the previous shortcut is unregistered before a new one is registered.
code example:
if (prevState.disableEnterShortCut !== this.state.disableEnterShortCut) {
this.unsubscribeEnter();
if (!this.state.disableEnterShortCut) {
this.subscribeToEnterShortcut();
}
}
@bernhardoj's proposal looks good to me.
This is critical bug many users are facing and reporting. So no need to wait for function component migration (#31739 is on hold for another issue) @quinthar@mallenexpensify we finally managed to find clear repro step.
Let's fix this!
Whoohooo... thanks for figuring out the repro steps, 🤞 it's fixed soon. It happened to me again today, I refreshed the page and it starting working again.
changed the title [-][$500] Cursor don't move to next line if return button tapped on keypad after back from referral[/-][+][HOLD for payment 2024-02-26] [$500] Cursor don't move to next line if return button tapped on keypad after back from referral[/+]on Feb 19, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.42-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve 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:
[@aimane-chnaif] The PR that introduced the bug has been identified. Link to the PR:
[@aimane-chnaif] 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:
[@aimane-chnaif] 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:
[@aimane-chnaif] Determine if we should create a regression test for this bug.
[@aimane-chnaif] 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.
[@abekkala] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
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: N/A
Determine if we should create a regression test for this bug.
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.
No need regression test. QA team has this test case already.
Activity
[-]Cursor don't move to next line if return button tapped on keypad after back from referral[/-][+][$500] Cursor don't move to next line if return button tapped on keypad after back from referral[/+]melvin-bot commentedon Jan 30, 2024
Job added to Upwork: https://www.upwork.com/jobs/~0150278de70234c5a1
melvin-bot commentedon Jan 30, 2024
Triggered auto assignment to @abekkala (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jan 30, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @aimane-chnaif (
External)bernhardoj commentedon Jan 30, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Pressing shift enter doesn't add a new line.
What is the root cause of that problem?
From the error, we can see that the
selectRowfromBaseOptionsSelectoris still called even after the page is closed, sothis.textInput.isFocused()throws an error because the text input is null now. The reasonselectRowis still called is because we have a hanging ENTER keyboard shortcut. This happens when we open the referral page, go back, and close the new chat page. Here is what happened:We have a
focusinlistener to disable the enter shortcut whenever an element with a role that is other than PRESENTATION is focused, and enable it infocusout.App/src/components/OptionsSelector/BaseOptionsSelector.js
Lines 273 to 284 in 82ae62f
App/src/components/OptionsSelector/BaseOptionsSelector.js
Lines 117 to 123 in 82ae62f
But we also "listen" to a focus state and unsubscribe/subscribe it based on the focus state.
App/src/components/OptionsSelector/BaseOptionsSelector.js
Lines 125 to 132 in 82ae62f
When we go back from the referral page, the page gains focus and
focusoutis also called. So, the enter shortcut is registered twice, but we can only have one instance of the shortcut to unsubscribe when the component unmount.App/src/components/OptionsSelector/BaseOptionsSelector.js
Line 304 in 82ae62f
App/src/components/OptionsSelector/BaseOptionsSelector.js
Line 339 in 82ae62f
What changes do you think we should make in order to solve the problem?
It would be great if the component is migrated to func component so we can use
useKeyboardShortcuthook and have a single place to either subscribe/unsubscribe the shortcut. But because we still use class component, we can always make sure the previous shortcut is unregistered before a new one is registered.code example:
aimane-chnaif commentedon Jan 30, 2024
@bernhardoj's proposal looks good to me.
This is critical bug many users are facing and reporting. So no need to wait for function component migration (#31739 is on hold for another issue)
@quinthar @mallenexpensify we finally managed to find clear repro step.
Let's fix this!
🎀 👀 🎀 C+ reviewed
melvin-bot commentedon Jan 30, 2024
Triggered auto assignment to @bondydaa, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
8 remaining items
mallenexpensify commentedon Jan 31, 2024
Whoohooo... thanks for figuring out the repro steps, 🤞 it's fixed soon. It happened to me again today, I refreshed the page and it starting working again.
[-][$500] Cursor don't move to next line if return button tapped on keypad after back from referral[/-][+][HOLD for payment 2024-02-26] [$500] Cursor don't move to next line if return button tapped on keypad after back from referral[/+]melvin-bot commentedon Feb 19, 2024
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Feb 19, 2024
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.42-5 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 2024-02-26. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Feb 19, 2024
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:
abekkala commentedon Feb 21, 2024
PAYMENT SUMMARY FOR FEB. 26
aimane-chnaif commentedon Feb 21, 2024
No need regression test. QA team has this test case already.
abekkala commentedon Feb 26, 2024
@bernhardoj and @aimane-chnaif - payment sent and contracts ended, thank you! 🎉