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-05-29] [$1000] Pressing ESC when emoji suggestions list is open clears the composer #18434

Closed
1 of 6 tasks
kavimuru opened this issue May 4, 2023 · 34 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 4, 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. Open any report
  2. Type some text and use semi colon syntax to show emoji suggestions. ex: test :rock
  3. Press esc, notice the composer is cleared

Expected Result:

Pressing ESC when emoji suggestions list is open should close the suggestions list, when the list is closed than pressing esc should clear it.

Actual Result:

Composer is cleared on pressing ESC when emoji suggestions are shown

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

Screen.Recording.2023-05-04.at.3.22.33.PM.mov
Recording.486.mp4

Expensify/Expensify Issue URL:
Issue reported by: https://expensify.slack.com/archives/C049HHMV9SM/p1683196034617709
Slack conversation: @huzaifa-99

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01808b10a5f865a8d3
  • Upwork Job ID: 1655655008391970816
  • Last Price Increase: 2023-05-15
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 4, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

MelvinBot commented May 4, 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

@hoangzinh
Copy link
Contributor

hoangzinh commented May 5, 2023

Proposal

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

Pressing ESC when emoji suggestions list is open clears the composer

What is the root cause of that problem?

The root cause is come from this hotkey listener

const shortcutConfig = CONST.KEYBOARD_SHORTCUTS.ESCAPE;
this.unsubscribeEscapeKey = KeyboardShortcut.subscribe(shortcutConfig.shortcutKey, () => {
if (!this.state.isFocused || this.comment.length === 0) {
return;
}
this.updateComment('', true);
}, shortcutConfig.descriptionKey, shortcutConfig.modifiers, true, true);

When we press "Escape" key, it will clear the content in composer.

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

We have a triggerHotkeyActions callback for composer box here. I think we shoud remove above hotkey listener, and move logic into this callback for centralize hotkey logic for composer.

That means, we need to update current triggerHotkeyActions callback so that, if user presses Escape hotkey, we need to check:

  • If having suggested emojis, we reset suggested emoji
  • Otherwise, reset composer content.

Code ref:

if (e.key === CONST.KEYBOARD_SHORTCUTS.ESCAPE.shortcutKey) {
    e.preventDefault();
    if (this.state.suggestedEmojis.length) {
        this.resetSuggestedEmojis();
    } else {
        this.updateComment('', true);
    }
    return;
}

What alternative solutions did you explore? (Optional)

Another option I would like to propose is still keep current keyboard listener in the componentDidMount, but update the condition so that it won't clear content if having suggested emojis. More details, replace this line by:

if (!this.state.isFocused || this.comment.length === 0 || this.state.suggestedEmojis.length)

@dylanexpensify
Copy link
Contributor

Didn't get to this today due to prioritizing Payroll, CPM, ECUK items! Will review Monday!

@dylanexpensify
Copy link
Contributor

Will work on reproducing today, then if good will make external

@melvin-bot melvin-bot bot added the Overdue label May 8, 2023
@dylanexpensify
Copy link
Contributor

Melvin, I just posted above!

@melvin-bot melvin-bot bot removed the Overdue label May 8, 2023
@dylanexpensify dylanexpensify added the External Added to denote the issue can be worked on by a contributor label May 8, 2023
@melvin-bot melvin-bot bot changed the title Pressing ESC when emoji suggestions list is open clears the composer [$1000] Pressing ESC when emoji suggestions list is open clears the composer May 8, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 8, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01808b10a5f865a8d3

@melvin-bot
Copy link

melvin-bot bot commented May 8, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 8, 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 8, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 8, 2023

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

@melvin-bot melvin-bot bot added the Overdue label May 10, 2023
@mollfpr
Copy link
Contributor

mollfpr commented May 11, 2023

@dylanexpensify Is not reproducible anymore; I think it's already fixed here #18469.

@melvin-bot melvin-bot bot removed the Overdue label May 11, 2023
@hoangzinh
Copy link
Contributor

hoangzinh commented May 11, 2023

I agree it fixed in PR mentioned above. But do you think it's worth to refactor it a bit like I mentioned in my proposal here => centralize hotkey logics in 1 place

@puneetlath
Copy link
Contributor

@hoangzinh would you mind explaining how your proposal is different than what we have today and why you think it would be better?

@hoangzinh
Copy link
Contributor

hoangzinh commented May 12, 2023

@puneetlath sure. So my point is centralize logic.
Currently in ReportActionCompose component, we have 2 place to handle ESCAPE keypress

  • One in componentDidMount. Beside that, with current implementation, we only clear content of composer when it's focused.
  • One in onKeyPress event of Composer component.

So I think it's better if we can centralize those logic in 1 place if it's possible like I suggested in my proposal #18434 (comment). Advantages:

  • Whenever we have any bugs related to ESCAPE key, we have all related logic in 1 place => easier to debug
  • Avoid some duplicated codes like checking suggestions exists.

So it's my point of views

@mollfpr
Copy link
Contributor

mollfpr commented May 12, 2023

I still feel good with the current implementation. @hoangzinh If you still think this should be done, let's drop it in Slack.

@melvin-bot melvin-bot bot added the Overdue label May 15, 2023
@dylanexpensify
Copy link
Contributor

Coming back from OOO! @hoangzinh did you bring this up in Slack?

@melvin-bot melvin-bot bot removed the Overdue label May 15, 2023
@mollfpr
Copy link
Contributor

mollfpr commented May 19, 2023

@dylanexpensify merged!

@puneetlath puneetlath added Weekly KSv2 and removed Daily KSv2 labels May 19, 2023
@dylanexpensify dylanexpensify removed their assignment May 22, 2023
@dylanexpensify dylanexpensify added Bug Something is broken. Auto assigns a BugZero manager. and removed Bug Something is broken. Auto assigns a BugZero manager. labels May 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 22, 2023

Current assignee @puneetlath is eligible for the Bug assigner, not assigning anyone new.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels May 22, 2023
@Expensify Expensify deleted a comment from melvin-bot bot May 22, 2023
@dylanexpensify dylanexpensify self-assigned this May 22, 2023
@dylanexpensify
Copy link
Contributor

I'm heading OOO tomorrow for about a week so adding another BZ member while I'm away to help keep the train moving! 🚂 @puneetlath lmk if this works ok with you assigned!

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels May 22, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Pressing ESC when emoji suggestions list is open clears the composer [HOLD for payment 2023-05-29] [$1000] Pressing ESC when emoji suggestions list is open clears the composer May 22, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 22, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 22, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 22, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.16-7 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-05-29. 🎊

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 @huzaifa-99
  • Contributor that fixed the issue @hoangzinh
  • 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 May 22, 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.
  • [@puneetlath / @dylanexpensify] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@puneetlath
Copy link
Contributor

@huzaifa-99 @hoangzinh can you apply to the Upwork job please? https://www.upwork.com/jobs/~01808b10a5f865a8d3

@hoangzinh
Copy link
Contributor

Applied to the Upwork job

@huzaifa-99
Copy link
Contributor

Applied. Thanks for the ping @puneetlath.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels May 29, 2023
@puneetlath
Copy link
Contributor

Paid @huzaifa-99 and @hoangzinh.

@mollfpr I'll pay you out once the checklist is done.

@mollfpr
Copy link
Contributor

mollfpr commented May 30, 2023

Thanks @puneetlath!

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

No offending PR

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

Regression step should be enough.

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

We can update the TC Compose Box - Emoji Suggestions

Desktop/Web - ESC Keypress

  1. Type :sm to open Emoji suggestion
  2. Press ESCAPE key
  3. Verify that the Emoji suggestion closed
  4. Type @ to open Mention suggestion
  5. Press ESCAPE key
  6. Verify that the Mention suggestion closed
  7. Press ESCAPE key again
  8. Verify that entire message is cleared
  9. 👍 or 👎

@puneetlath
Copy link
Contributor

Thanks @mollfpr looks great.

Issue to create regression test is here: https://github.com/Expensify/Expensify/issues/287251

And everyone has been paid. Thanks everyone!

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