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-11-27] [$500] Chat - Keyboard is displayed on header menu screen after sending a file larger than 24 MB #31426

Closed
4 of 6 tasks
izarutskaya opened this issue Nov 16, 2023 · 32 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

@izarutskaya
Copy link

izarutskaya commented Nov 16, 2023

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


Version Number: 1.4.0-0
Reproducible in staging?: Y
Reproducible in production?: N
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:

Pre-requisite: user must be logged in.

  1. Go to any chat.
  2. Try to send a file larger than the 24 MB limit.
  3. Close the "Attachment too large" modal.
  4. Tap on the chat header.

Expected Result:

The header menu screen should be completely displayed without any issues.

Actual Result:

The keyboard is displayed on the screen.

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

Bug6278652_1700113961015.Lsna2309_1_.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014dbc5e01561f3f10
  • Upwork Job ID: 1725093833215246336
  • Last Price Increase: 2023-11-16
  • Automatic offers:
    • situchan | Contributor | 27705823
@izarutskaya izarutskaya 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 Nov 16, 2023
@melvin-bot melvin-bot bot changed the title Chat - Keyboard is displayed on header menu screen after sending a file larger than 24 MB [$500] Chat - Keyboard is displayed on header menu screen after sending a file larger than 24 MB Nov 16, 2023
Copy link

melvin-bot bot commented Nov 16, 2023

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

Copy link

melvin-bot bot commented Nov 16, 2023

Job added to Upwork: https://www.upwork.com/jobs/~014dbc5e01561f3f10

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

melvin-bot bot commented Nov 16, 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

Copy link

melvin-bot bot commented Nov 16, 2023

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

@izarutskaya
Copy link
Author

Not repro in prod

RPReplay_Final1700113029.MP4

@izarutskaya izarutskaya added the DeployBlockerCash This issue or pull request should block deployment label Nov 16, 2023
@dukenv0307
Copy link
Contributor

dukenv0307 commented Nov 16, 2023

I'm available to raise a PR immediately if assigned

Proposal

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

The keyboard is displayed on the screen.

What is the root cause of that problem?

In here, we'll trigger onPopoverMenuClose when the screen lose focus, without checking if the popover menu is still visible at that time, causing the issue.

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

Make sure the popover menu is currently visible first before calling onPopoverMenuClose. If it's not currently visible, we should not call onPopoverMenuClose because nothing is closing here.

useEffect(() => {
    if (!isMenuVisible || !didScreenBecomeInactive()) {
        return;
    }
    onPopoverMenuClose();
}, [didScreenBecomeInactive, onPopoverMenuClose, isMenuVisible]);

What alternative solutions did you explore? (Optional)

This will make the behavior when closing the attachment error modal to be the same as on prod. If instead we want to open the keyboard after closing the attachment error modal, we need to trigger restoreKeyboardState after that attachment error modal closes.

@situchan
Copy link
Contributor

@dukenv0307 this is marked as deploy blocker. What is offending PR?

@ntdiary
Copy link
Contributor

ntdiary commented Nov 16, 2023

@situchan, I have less bandwidth, it would be better if you can take over now. :)

cc @MitchExpensify

@situchan
Copy link
Contributor

@ntdiary sure thanks

@ntdiary ntdiary removed their assignment Nov 16, 2023
@dukenv0307
Copy link
Contributor

@situchan This PR #30864 cause the regression.

@situchan
Copy link
Contributor

Hmm, #30864 was deployed to production yesterday so should be repro on production as well.

@bernhardoj
Copy link
Contributor

Just giving an alternative.

Proposal

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

A keyboard is shown when pressing the chat header after sending a large file (> 24 MB)

What is the root cause of that problem?

This is a recent regression from #30864. From the linked PR, it looks like the PR is deployed to production already, but then the bot add a new comment that the PR is deployed to staging again. Could the "deployed to prod" is a false alarm?

In AttachmentPickerWithMenuItems, we call onPopoverMenuClose whenever the screen becomes unfocused.

// When the navigation is focused, we want to close the popover menu.
useEffect(() => {
if (!didScreenBecomeInactive()) {
return;
}
onPopoverMenuClose();
}, [didScreenBecomeInactive, onPopoverMenuClose]);

What it does is hide the popover menu and call onMenuClosed. onMenuClosed will show the keyboard back if isKeyboardVisibleWhenShowingModalRef is true.

const restoreKeyboardState = useCallback(() => {
if (!isKeyboardVisibleWhenShowingModalRef.current) {
return;
}
focus();
isKeyboardVisibleWhenShowingModalRef.current = false;
}, []);

isKeyboardVisibleWhenShowingModalRef is set to true when we press the "Add attachment".

const onTriggerAttachmentPicker = useCallback(() => {
// Set a flag to block suggestion calculation until we're finished using the file picker,
// which will stop any flickering as the file picker opens on non-native devices.
if (willBlurTextInputOnTapOutside) {
suggestionsRef.current.setShouldBlockSuggestionCalc(true);
}
isNextModalWillOpenRef.current = true;
isKeyboardVisibleWhenShowingModalRef.current = true;
}, []);

However, isKeyboardVisibleWhenShowingModalRef is never reset back to false when the attachment error modal is closed. So, when the report screen is out of focus, the onMenuClosed is called (first issue) and the focus is triggered because isKeyboardVisibleWhenShowingModalRef is still true (second issue).

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

Fixing one of them is enough but I think we should fix both.

I think it's fine to call onPopoverMenuClose whenever the screen is out of focus, but the problem is that we should call onMenuClosed only when the modal is really closed. To do that, we should call it inside the modal onModalHide

const onPopoverMenuClose = useCallback(() => {
    setMenuVisibility(false);
-   onMenuClosed();
}, [onMenuClosed, setMenuVisibility]);

<Modal
    onModalHide={onMenuClosed}

The reason I like this solution is that we avoid calling onMenuClosed too early (called before the modal is actually closed).
Because it's called too early, we focus the composer with a delay which raises this issue which introduces the 2nd issue

For the 2nd issue, we should reset isKeyboardVisibleWhenShowingModalRef back to false when the attachment error modal is closed. To do that, we should pass props.onModalHide to the attachment error modal.

<ConfirmModal
title={attachmentInvalidReasonTitle ? translate(attachmentInvalidReasonTitle) : ''}
onConfirm={closeConfirmModal}
onCancel={closeConfirmModal}
isVisible={isAttachmentInvalid}
prompt={attachmentInvalidReason ? translate(attachmentInvalidReason) : ''}
confirmText={translate('common.close')}
shouldShowCancelButton={false}
/>

props.onModalHide will do the reset.

onModalHide={onAttachmentPreviewClose}

const onAttachmentPreviewClose = useCallback(() => {
updateShouldShowSuggestionMenuToFalse();
setIsAttachmentPreviewActive(false);
restoreKeyboardState();
}, [updateShouldShowSuggestionMenuToFalse, restoreKeyboardState]);

@situchan
Copy link
Contributor

situchan commented Nov 16, 2023

We can confirm if it's false alarm by reverting that PR locally and test.

@bernhardoj
Copy link
Contributor

Yep, you can try removing this code (which is introduced from that PR) and the issue will go away

// When the navigation is focused, we want to close the popover menu.
useEffect(() => {
if (!didScreenBecomeInactive()) {
return;
}
onPopoverMenuClose();
}, [didScreenBecomeInactive, onPopoverMenuClose]);

@situchan
Copy link
Contributor

situchan commented Nov 16, 2023

As the original issue is edge case and not that critical, I suggest to revert to unblock deploy.
Here's PR: #31457

@roryabraham
Copy link
Contributor

roryabraham commented Nov 16, 2023

Don't mind me, just going to remove and re-add the deploy blocker label to test something

Update for the curious: it worked ... PR / workflow run

@roryabraham roryabraham removed the DeployBlockerCash This issue or pull request should block deployment label Nov 16, 2023
Copy link

melvin-bot bot commented Nov 16, 2023

Triggered auto assignment to @tylerkaraszewski (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@pecanoro
Copy link
Contributor

lol I already reviewed the PR, so I am going to reassign

@situchan
Copy link
Contributor

Please assign me as well based on #31426 (comment)

@pecanoro pecanoro added Reviewing Has a PR in review and removed Help Wanted Apply this label when an issue is open to proposals by contributors labels Nov 16, 2023
Copy link

melvin-bot bot commented Nov 16, 2023

📣 @situchan 🎉 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 📖

@roryabraham roryabraham removed the DeployBlockerCash This issue or pull request should block deployment label Nov 17, 2023
@roryabraham
Copy link
Contributor

The fix for this has been verified on staging

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Hourly KSv2 labels Nov 20, 2023
@melvin-bot melvin-bot bot changed the title [$500] Chat - Keyboard is displayed on header menu screen after sending a file larger than 24 MB [HOLD for payment 2023-11-27] [$500] Chat - Keyboard is displayed on header menu screen after sending a file larger than 24 MB Nov 20, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Nov 20, 2023
Copy link

melvin-bot bot commented Nov 20, 2023

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

Copy link

melvin-bot bot commented Nov 20, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.0-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-11-27. 🎊

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:

Copy link

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

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

@MitchExpensify
Copy link
Contributor

Reminder set to pay, please take a look at the BZ steps when you have a chance @situchan 🙇

@dukenv0307
Copy link
Contributor

@situchan since we did the straight revert, what's the next step here? Should we modify the proposals to add back the fix in #30864 and fix the regression in it?

@situchan
Copy link
Contributor

@dukenv0307 Nothing left here.
I think @ishpaul777 and @eVoloshchak will work on new PR in #29379.

@MitchExpensify
Copy link
Contributor

Payment summary:

$500 - @situchan C+

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Nov 27, 2023
@MitchExpensify
Copy link
Contributor

Paid, contract ended, do we need BZ steps here @situchan ?

@situchan
Copy link
Contributor

The offending PR author/reviewer are already aware of this regression.
The bug was caught by QA team so no more regression test is needed.
So I think we can complete BZ checklist with this info.

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