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-10-18] [$500] Web - Chat - Able to type in composer while popover is open #25485

Closed
1 of 6 tasks
izarutskaya opened this issue Aug 18, 2023 · 86 comments
Closed
1 of 6 tasks
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

@izarutskaya
Copy link

izarutskaya commented Aug 18, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Open any chat
  2. Right click on any message
  3. Write anything from keyboard
  4. Observe composer

Expected Result:

When any popover is open, composer should be blurred and not able to type in composer

The fix should not break the current behavior (when none of the popover or RHP modal is open, typing anything should focus on the composer automatically but not paste)

Actual Result:

You're able to type via the composer

Workaround:

Unknown

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: v1.3.55-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

Bug.mp4
Recording.5913.mp4

Expensify/Expensify Issue URL:

Issue reported by: @aimane

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1691526238059509

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01fecf2f053b61b171
  • Upwork Job ID: 1693637662419955712
  • Last Price Increase: 2023-10-19
  • Automatic offers:
    • aimane-chnaif | Reviewer | 27015731
    • mkhutornyi | Contributor | 27015733
Issue OwnerCurrent Issue Owner: @maddylewis
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 18, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 18, 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 Aug 18, 2023

Proposal

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

Web - Chat - Able to type in composer while popover is open

What is the root cause of that problem?

  1. The report action context menu is passing the withoutOverlay to the Popover, that means it would like to use new PopoverWithoutOverlay that is just introduced recently. Because our new PopoverWithoutOverlay is not base modal anymore, it wont call Modal.setModalVisibility to set it's true when a modal is opened.
  2. In the Report composer, we have a keypress listener, it will focus on composer if the isComposerVisible is true
    checkComposerVisibility() {
    const isComposerCoveredUp = EmojiPickerActions.isEmojiPickerVisible() || this.state.isMenuVisible || this.props.modal.isVisible;
    return !isComposerCoveredUp;
    }
    focusComposerOnKeyPress(e) {
    const isComposerVisible = this.checkComposerVisibility();
    if (!isComposerVisible) {
    return;
    }

Currently, we only check EmojiPickerActions.isEmojiPickerVisible, this.state.isMenuVisible and this.props.modal.isVisible. We haven't checked the new PopoverWithoutOverlay open state yet to check whether if the composer is covered up by context menu.

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

The isOpen state of new PopoverWithoutOverlay is in the PopoverContextProvider, we can consume this context in the ReportActionCompose component, then check the isOpen state of new PopoverWithoutOverlay in this function as well

checkComposerVisibility() {
const isComposerCoveredUp = EmojiPickerActions.isEmojiPickerVisible() || this.state.isMenuVisible || this.props.modal.isVisible;
return !isComposerCoveredUp;
}

If it's true, we should return false for that function too. Then in the keypress listener, it will early exit because the composer is not visible here

@aimane-chnaif
Copy link
Contributor

@hoangzinh your proposal makes sense but unfortunately it might cause regression of not being able to paste even when composer is focused, especially when LHN popover is open

Screen.Recording.2023-08-18.at.6.13.17.PM.mov

Solution:

  1. always blur composer when any popover is open
  2. keep composer focused state as is now and still let user type or paste in composer when focused

@maddylewis which option do you suggest?

@melvin-bot melvin-bot bot added the Overdue label Aug 21, 2023
@maddylewis maddylewis added the External Added to denote the issue can be worked on by a contributor label Aug 21, 2023
@melvin-bot melvin-bot bot changed the title Web - Chat - Able to type in composer while popover is open [$1000] Web - Chat - Able to type in composer while popover is open Aug 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01fecf2f053b61b171

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

melvin-bot bot commented Aug 21, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 21, 2023

Current assignee @aimane-chnaif is eligible for the External assigner, not assigning anyone new.

@maddylewis
Copy link
Contributor

thanks for jumping on this one @aimane-chnaif - i went ahead and assigned you to the issue since you were already reviewing the proposals.

@melvin-bot melvin-bot bot removed the Overdue label Aug 21, 2023
@maddylewis
Copy link
Contributor

@aimane-chnaif - i think option 2

@aimane-chnaif
Copy link
Contributor

Thanks.

So the expected behavior is:
when popover is open

  • if composer is not focused, should not be able to type/paste
  • if composer is focused, should be able to type/paste

And the fix should not break current behavior: when none of popover or RHP modal is open, typing anything should focus on composer automatically but not paste.

@melvin-bot melvin-bot bot added the Overdue label Aug 24, 2023
@maddylewis
Copy link
Contributor

okay, gotcha. how would you like to proceed? let me know if you would like me to update the OP with those details you outlined here #25485 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Aug 24, 2023
@aimane-chnaif
Copy link
Contributor

sure, let's update OP so that contributors post/update their proposals correctly

@bernisz
Copy link

bernisz commented Aug 27, 2023

Proposal

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

Web - Chat - Able to type/paste in composer while popover is open

What is the root cause of that problem?

For typing problem: there is no check in checkComposerVisibility function that indicates if ReportActionContextMenu popover is open.
For pasting problem: in Composer component last useEffect hook is missing handlePaste dependency. Without it handlePaste is using initial states/callback functions.

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

Changes in ReportScreen.js

We can create a new flag isReportActionContextMenuVisible with setter that can be accessed by children using ReportScreenContext.Provider

Changes in ReportActionItem.js

In showPopover function add these lines:

// Hides older context menu when right-clicking on other action item
ReportActionContextMenu.hideContextMenu();

setIsReportActionContextMenuVisible(true);

Also need to update toggleContextMenuFromActiveReportAction function to handle isReportActionContextMenuVisible state when closing popover:

const toggleContextMenuFromActiveReportAction = useCallback(() => {
        const activeReportAction = ReportActionContextMenu.isActiveReportAction(props.action.reportActionID);
        setIsContextMenuActive(activeReportAction);
        setIsReportActionContextMenuVisible(activeReportAction);
    }, [props.action.reportActionID, setIsContextMenuVisible]);
Changes in ComposerWithSuggestions.js

Update checkComposerVisibility function by adding isReportActionContextMenuVisible to condition:

const {isReportActionContextMenuVisible} = useContext(ReportScreenContext);

const checkComposerVisibility = useCallback(() => {
        const isComposerCoveredUp = EmojiPickerActions.isEmojiPickerVisible() || isMenuVisible || isReportActionContextMenuVisible || modal.isVisible;
        return !isComposerCoveredUp;
    }, [isReportActionContextMenuVisible, isMenuVisible, modal.isVisible]);
Changes in Composer > index.js

Add handlePaste function as dependency in last useEffect hook.

Result

screen-capture.1.webm

@melvin-bot melvin-bot bot added the Overdue label Aug 27, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 27, 2023

📣 @bernisz! 📣
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>

@bernisz
Copy link

bernisz commented Aug 27, 2023

Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01e0c3c2f51c15da8b

@melvin-bot
Copy link

melvin-bot bot commented Aug 27, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 28, 2023

@maddylewis, @aimane-chnaif Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot changed the title [$1000] Web - Chat - Able to type in composer while popover is open [HOLD for payment 2023-10-18] [$1000] Web - Chat - Able to type in composer while popover is open Oct 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 11, 2023

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 11, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.80-3 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-18. 🎊

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:

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 Oct 11, 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:

  • [@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.
  • [@maddylewis] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@maddylewis maddylewis added Daily KSv2 and removed Weekly KSv2 labels Oct 16, 2023
@maddylewis
Copy link
Contributor

moving to daily since payments are coming up

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Daily KSv2 labels Oct 17, 2023
@maddylewis
Copy link
Contributor

maddylewis commented Oct 19, 2023

Payments

Contributor hired Oct 2. PR merged Oct 9.

@melvin-bot melvin-bot bot removed the Overdue label Oct 19, 2023
@maddylewis maddylewis changed the title [HOLD for payment 2023-10-18] [$1000] Web - Chat - Able to type in composer while popover is open [HOLD for payment 2023-10-18] [$500] Web - Chat - Able to type in composer while popover is open Oct 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 19, 2023

Upwork job price has been updated to $500

@maddylewis
Copy link
Contributor

Okay, payments were sent.

@aimane-chnaif - will you take a look at this checklist when you get a chance - thanks! #25485 (comment)

@aimane-chnaif
Copy link
Contributor

aimane-chnaif commented Oct 19, 2023

@maddylewis was there any reason to lower the price? This GH was created and made external before announcement so I think original base price applies here.

announce

Also, eligible for bonus as PR was C+ approved in less than 2 days and no changes were requested

@aimane-chnaif
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: Fix: Composer does not refocus on clicking the same chat in LHN #21552
  • 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/21552/files#r1365671613
  • 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.

Regression Test Proposal

(web/desktop only)

  1. Go to any chat and focus on composer
  2. Add reaction to any message
  3. Verify that composer is still focused
  4. Right click on reaction
  5. Verify that composer is blurred
  6. Re-focus on composer
  7. Right click on any LHN option row
  8. Verify that composer is blurred

@maddylewis
Copy link
Contributor

my thinking there is that the proposal that was used, the review and implementation happened after the update was live. is that fair? lmk if that's not accurate.

@mkhutornyi
Copy link
Contributor

I researched and submitted proposal at the time of 1k in issue title.

i.e. #25975
created on Aug 25 (before price change)
proposal submitted on Sep 1 (after price change) and accepted on Sep 5
payment summary: 1.5k including bonus

@aimane-chnaif
Copy link
Contributor

Another instance:
#25967 (comment)
#25967 (comment)

@melvin-bot melvin-bot bot added the Overdue label Oct 25, 2023
@amyevans
Copy link
Contributor

Friendly bump @maddylewis for payment

@melvin-bot melvin-bot bot removed the Overdue label Oct 25, 2023
@maddylewis
Copy link
Contributor

kk, ty for the breakdown @mkhutornyi. it sounds like i owe both @aimane-chnaif and @mkhutornyi an additional payment.

can you clarify the urgency bonus? i have the following info - Contributor hired Oct 2 and PR merged Oct 9.

@aimane-chnaif
Copy link
Contributor

aimane-chnaif commented Oct 26, 2023

@maddylewis yes eligible. Contributor hired on Oct 4

Screenshot 2023-10-26 at 10 03 43 AM

PR was approved in 42 hrs. And no changes requested before merge.

Screenshot 2023-10-26 at 10 02 20 AM

@maddylewis
Copy link
Contributor

Okay, sounds good! I sent both the Contributor and the C+ an additional $1k payment for this one. regression test steps added. closing!

@aimane-chnaif
Copy link
Contributor

@maddylewis sorry I haven't received additional 1k yet. Can you please confirm once again? Sorry for inconvenience 🙏

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

9 participants