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 2023-06-15] [$1000] The cursor does not move to the next line after pressing Shift+Enter while using the mention feature. #19624

Closed
1 of 6 tasks
kavimuru opened this issue May 25, 2023 · 54 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 May 25, 2023

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


Action Performed:

  1. Go to any chat.
  2. Type "@" and press Shift+Enter.
  3. Notice that instead of moving to the next line, the user is selected from the popup.

Expected Result:

The cursor should move to the next line when Shift+Enter is pressed.

Actual Result:

The cursor does not move to the next line when Shift+Enter is pressed. Instead, the first option from the popup is selected when using the mention feature.
NOTE: Same happening with emoji too

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.18-2
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
Notes/Photos/Videos: Any additional supporting documentation

Bug.2.mp4
Recording.760.mp4

Expensify/Expensify Issue URL:
Issue reported by: @usmantariq96
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1684834428858769

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01830e384c4fcaaa98
  • Upwork Job ID: 1663633838374625280
  • Last Price Increase: 2023-05-30
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 25, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 25, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@dhairyasenjaliya
Copy link
Contributor

dhairyasenjaliya commented May 25, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

  • The cursor should move to the next line when Shift+Enter is pressed.

What is the root cause of that problem?

  • The root cause is we are have not defined the key if we have pressed Enter + shift and if there are suggestion list (mentioned or emoji) then we need to have a new line (more sort of feature request since we never have defined this )

What changes do you think we should make in order to solve the problem?

  • In order to have a new line while the suggestion is open we need to define the logical condition on triggerHotkeyActions on ReportActionCompose.js

  • After testing we find that there is no need to add additional validation as proposed earlier, we just need to modify the current condition to check if we press shiftKey along with enter key based on that we can simply return early

  • Above condition works for both the mentioned user and also works well on the emojisuggestion list basically these conditionals will work the same as Slack does 


        if (((!e.shiftKey && e.key === CONST.KEYBOARD_SHORTCUTS.ENTER.shortcutKey) || e.key === CONST.KEYBOARD_SHORTCUTS.TAB.shortcutKey) && suggestionsExist) {
            e.preventDefault();
            if (this.state.suggestedEmojis.length > 0) {
                this.insertSelectedEmoji(this.state.highlightedEmojiIndex);
            }
            if (this.state.suggestedMentions.length > 0) {
                this.insertSelectedMention(this.state.highlightedMentionIndex);
            }
            return;
        }

Result



Screen.Recording.2023-05-26.at.1.23.01.AM.mov

@dukenv0307
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

The cursor does not move to the next line after pressing Shift+Enter while using the mention feature

What is the root cause of that problem?

https://github.com/Expensify/App/blob/21fefdb19cd7262f9caaad132d30ea426426f017/src/pages/home/report/ReportActionCompose.js#L796-805
If the suggestion is open and we click Enter, we will insert the suggestion into the composer (even if Enter is triggered with another button)

What changes do you think we should make in order to solve the problem?

if ((e.key === CONST.KEYBOARD_SHORTCUTS.ENTER.shortcutKey || e.key === CONST.KEYBOARD_SHORTCUTS.TAB.shortcutKey) && suggestionsExist) {

Here we should add a condition !e.shiftKey like this

 if (((e.key === CONST.KEYBOARD_SHORTCUTS.ENTER.shortcutKey && !e.shiftKey) || e.key === CONST.KEYBOARD_SHORTCUTS.TAB.shortcutKey) && suggestionsExist) {

What alternative solutions did you explore? (Optional)

NA

@melvin-bot melvin-bot bot added the Overdue label May 29, 2023
@twisterdotcom
Copy link
Contributor

@melvin-bot melvin-bot bot removed the Overdue label May 30, 2023
@twisterdotcom twisterdotcom added External Added to denote the issue can be worked on by a contributor Overdue labels May 30, 2023
@melvin-bot melvin-bot bot changed the title The cursor does not move to the next line after pressing Shift+Enter while using the mention feature. [$1000] The cursor does not move to the next line after pressing Shift+Enter while using the mention feature. May 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 30, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01830e384c4fcaaa98

@melvin-bot
Copy link

melvin-bot bot commented May 30, 2023

Current assignee @twisterdotcom is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented May 30, 2023

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

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

melvin-bot bot commented May 30, 2023

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

@code0406
Copy link
Contributor

code0406 commented Jun 1, 2023

Proposal

Please re-state the problem that we are trying to solve in this issue.

The cursor does not move to the next line when Shift+Enter is pressed (when suggestions and emoji panels are opened.)

What is the root cause of that problem?

The root cause is:
in this case, the emoji or suggestion panel is shown first(when type '@' or ':'), it's correct logic.
and then when pressing SHIFT + ENTER, we should catch it on the parent side, and ignore the "Emoji" or "Suggestion" selection. but it was skipped.

What changes do you think we should make in order to solve the problem?

We should consider the "Shift" key-pressed event in the current key event module.
The target code to be fixed is in the function "triggerHotkeyActions" of the "ReportActionCompose.js" file.

1. Check if the "Shift" key is pressed in Emoji, suggestion cases. Other cases are working well. 
if (e.shiftKey) //detect the shift key pressed

2. if the key was pressed, then skip the Emoji, and suggestion actions and close the panel.
if (this.state.suggestedMentions.length > 0) {
  if (e.shiftKey)
    e.preventDefault();
    this.setShouldShowSuggestionsMenuToFalse();
    ...

It is fixed by simple code updating using already implemented functions.

What alternative solutions did you explore? (Optional)

I've checked and confirmed it 100%.
I shared the video that I fixed this issue.

issues19624.mp4

If github video does not play, then please check it in this uploaded link:
https://drive.google.com/file/d/1F2kOe0Wduc9C5KhBteq2coWf-OpKwk2-/view?usp=sharing

@melvin-bot
Copy link

melvin-bot bot commented Jun 1, 2023

📣 @code0406! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@code0406
Copy link
Contributor

code0406 commented Jun 1, 2023

Contributor details
Your Expensify account email: d842443@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01b5053339c1ddbe12

@melvin-bot
Copy link

melvin-bot bot commented Jun 1, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@mollfpr
Copy link
Contributor

mollfpr commented Jun 1, 2023

Because it was not processed in the KEY event module.

@code0406 Which key do you mean?

@code0406
Copy link
Contributor

code0406 commented Jun 1, 2023

Because it was not processed in the KEY event module.

@code0406 Which key do you mean?

I will share the screenshot.
This is the final code part to be fixed for the issue.
image

If you need, I will share the code diff.
Thank you.

@dhairyasenjaliya
Copy link
Contributor

@mollfpr can you review this prospal as well #19624 (comment)

@code0406
Copy link
Contributor

code0406 commented Jun 1, 2023

Because it was not processed in the KEY event module.

@code0406 Which key do you mean?

The current code is almost perfect.
So we don't need to change or clear any data.

  1. just check the Shift Key pressed case,
  2. call the useful function that was implemented already.

That's all.

@mollfpr
Copy link
Contributor

mollfpr commented Jun 1, 2023

@dhairyasenjaliya Thanks. I almost forget there’s another proposal above.

@melvin-bot melvin-bot bot added the Overdue label Jun 5, 2023
@twisterdotcom
Copy link
Contributor

@cristipaval bump on this please.

@melvin-bot melvin-bot bot removed the Overdue label Jun 5, 2023
@cristipaval
Copy link
Contributor

@cristipaval the proposal from @dhairyasenjaliya looks good to me!

🎀 👀 🎀 C+ reviewed!

Thanks @mollfpr !

@dhairyasenjaliya you're all set.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Jun 5, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 5, 2023

📣 @dhairyasenjaliya You have been assigned to this job by @cristipaval!
Please apply to this job in Upwork 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 📖

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Jun 5, 2023
@dhairyasenjaliya
Copy link
Contributor

@mollfpr @cristipaval PR ready for review

@twisterdotcom
Copy link
Contributor

Oooh! Merged.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Jun 8, 2023
@melvin-bot melvin-bot bot changed the title [$1000] The cursor does not move to the next line after pressing Shift+Enter while using the mention feature. [HOLD for payment 2023-06-15] [$1000] The cursor does not move to the next line after pressing Shift+Enter while using the mention feature. Jun 8, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 8, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jun 8, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jun 8, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.25-8 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-06-15. 🎊

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

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

  • [@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
  • [@mollfpr] 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:
  • [@mollfpr] 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] Determine if we should create a regression test for this bug.
  • [@mollfpr] 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.
  • [@twisterdotcom] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jun 14, 2023
@mollfpr mollfpr mentioned this issue Jun 15, 2023
57 tasks
@mollfpr
Copy link
Contributor

mollfpr commented Jun 15, 2023

[@mollfpr] The PR that introduced the bug has been identified. Link to the PR:

#18469

[@mollfpr] 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:

https://github.com/Expensify/App/pull/18469/files#r1231104731

[@mollfpr] 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:

https://expensify.slack.com/archives/C049HHMV9SM/p1686839540389379

[@mollfpr] Determine if we should create a regression test for this bug.

Yes!

[@mollfpr] 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.

  1. Go to any chat.
  2. Type "@" and press Shift+Enter.
  3. Verify the cursor should be placed on the next line without selecting a suggestion, and the suggestion box should be closed
  4. 👍 or 👎

@twisterdotcom
Copy link
Contributor

Sorry folks, I've been getting this all day:
image

@twisterdotcom
Copy link
Contributor

I think I managed to pay you all via the Upwork iOS app on my mobile data.

@melvin-bot melvin-bot bot removed the Overdue label Jun 19, 2023
@twisterdotcom
Copy link
Contributor

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

7 participants