Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[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

Closed
2 of 6 tasks
kavimuru opened this issue Jan 30, 2024 · 17 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@kavimuru
Copy link

kavimuru commented Jan 30, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


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:

  1. Tap on FAB button >> Start Chat
  2. Click on "Start a Chat, get $250" referral banner
  3. Go back to start chat
  4. Search or select any user
  5. Tap on compose box
  6. Enter any message
  7. 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?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6360432_1706588215346.WEB-Issuerepro_with_console_error.mp4
Bug6360432_1706588215335.RPReplay_Final1706581653_1_.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0150278de70234c5a1
  • Upwork Job ID: 1752280699709931520
  • Last Price Increase: 2024-01-30
  • Automatic offers:
    • aimane-chnaif | Reviewer | 28130727
    • bernhardoj | Contributor | 28130728
@kavimuru kavimuru added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jan 30, 2024
@melvin-bot melvin-bot bot 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 Jan 30, 2024
Copy link

melvin-bot bot commented Jan 30, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0150278de70234c5a1

Copy link

melvin-bot bot commented Jan 30, 2024

Triggered auto assignment to @abekkala (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 30, 2024
Copy link

melvin-bot bot commented Jan 30, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @aimane-chnaif (External)

@bernhardoj
Copy link
Contributor

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 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.

handleFocusIn() {
const activeElement = document.activeElement;
this.setState({
disableEnterShortCut: activeElement && this.accessibilityRoles.includes(activeElement.role) && activeElement.role !== CONST.ROLE.PRESENTATION,
});
}
handleFocusOut() {
this.setState({
disableEnterShortCut: false,
});
}

if (prevState.disableEnterShortCut !== this.state.disableEnterShortCut) {
if (this.state.disableEnterShortCut) {
this.unsubscribeEnter();
} else {
this.subscribeToEnterShortcut();
}
}

But we also "listen" to a focus state and unsubscribe/subscribe it based on the focus state.

if (prevProps.isFocused !== this.props.isFocused) {
if (this.props.isFocused) {
this.subscribeToEnterShortcut();
this.subscribeToCtrlEnterShortcut();
} else {
this.unSubscribeFromKeyboardShortcut();
}
}

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.

this.unsubscribeEnter = KeyboardShortcut.subscribe(

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();
    }
}

@aimane-chnaif
Copy link
Contributor

@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

Copy link

melvin-bot bot commented Jan 30, 2024

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 30, 2024
Copy link

melvin-bot bot commented Jan 30, 2024

📣 @aimane-chnaif 🎉 An offer has been automatically sent to your Upwork account for the Reviewer role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

Copy link

melvin-bot bot commented Jan 30, 2024

📣 @bernhardoj 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@bondydaa
Copy link
Contributor

👍 i don't think we need to wait to refactor to a functional component, fix the lingering event listener (and throw a comment in stating why we are doing it so when we do refactor it we don't re-introduce the bug).

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Jan 30, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @aimane-chnaif

@mallenexpensify
Copy link
Contributor

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.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Feb 19, 2024
@melvin-bot melvin-bot bot 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 Feb 19, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 19, 2024
Copy link

melvin-bot bot commented Feb 19, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented 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:

Copy link

melvin-bot bot commented 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:

  • [@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:

@abekkala
Copy link
Contributor

abekkala commented Feb 21, 2024

PAYMENT SUMMARY FOR FEB. 26

  • Issue reported by: Applause internal team
  • Fix: @bernhardoj [$500 - if no regressions] offer
  • PR Review: @aimane-chnaif [$500 - if no regressions] offer please complete checklist

@aimane-chnaif
Copy link
Contributor

No need regression test. QA team has this test case already.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 26, 2024
@abekkala
Copy link
Contributor

@bernhardoj and @aimane-chnaif - payment sent and contracts ended, thank you! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

6 participants