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

[$125] mWeb - Chat - While editing composer doesn't hide and the editing input doesn't get focused #48161

Open
1 of 6 tasks
IuliiaHerets opened this issue Aug 28, 2024 · 25 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Aug 28, 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: 9.0.25-10
Reproducible in staging?: Y
Reproducible in production?: N
Issue was found when executing this PR: #45150
Email or phone of affected tester (no customers): nathanmulugetatesting+1186@gmail.com
Issue reported by: Applause Internal Team

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Open a chat and send a message
  3. Hold on the sent message and tap on "Edit comment"

Expected Result:

The compose box hides and the app focuses on the edit input field

Actual Result:

The composer box doesn't hide and both the compose box and the edit input are visible. The app sometimes doesn't focus on the edit input field after clicking on "Edit comment". If the app focuses on the edit input field then the cursor jumps at the start of the text.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6585078_1724838596672.Screen_Recording_20240828_124410_Chrome.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021833542585900797797
  • Upwork Job ID: 1833542585900797797
  • Last Price Increase: 2024-09-10
  • Automatic offers:
    • ikevin127 | Reviewer | 103900666
Issue OwnerCurrent Issue Owner: @ikevin127
@IuliiaHerets IuliiaHerets added DeployBlockerCash This issue or pull request should block deployment Bug Something is broken. Auto assigns a BugZero manager. labels Aug 28, 2024
Copy link

melvin-bot bot commented Aug 28, 2024

Triggered auto assignment to @youssef-lr (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link

melvin-bot bot commented Aug 28, 2024

Triggered auto assignment to @miljakljajic (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@melvin-bot melvin-bot bot added the Daily KSv2 label Aug 28, 2024
@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Aug 28, 2024
Copy link
Contributor

👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.

@IuliiaHerets
Copy link
Author

We think that this bug might be related to #wave-collect - Release 1

Copy link

melvin-bot bot commented Aug 28, 2024

📣 @LC-JiaZhaorong! 📣
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. Make sure you've read and understood the contributing guidelines.
  2. 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.
  3. 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.
  4. 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>

@youssef-lr
Copy link
Contributor

@Skalakid can you take a look at this issue please? Seems related to #45150

@youssef-lr youssef-lr added Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Aug 28, 2024
@bernhardoj
Copy link
Contributor

Proposal

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

When editing a message, the main composer doesn't hide and the edit composer also doesn't have the green outline focus.

What is the root cause of that problem?

The focus on the composer happens too early before the modal is completely hidden.

This is similar to #46095. When we press edit, we close the modal and wait it be hidden and finally set the draft message to be the current message.

const editAction = () => {
if (!draftMessage) {
Report.saveReportActionDraft(reportID, reportAction, Parser.htmlToMarkdown(getActionHtml(reportAction)));
} else {
Report.deleteReportActionDraft(reportID, reportAction);
}
};
if (closePopover) {
// Hide popover, then call editAction
hideContextMenu(false, editAction);
return;
}

When the draft message is available, we focus on the edit composer.

useEffect(() => {
if (prevDraftMessage !== undefined || draftMessage === undefined) {
return;
}
focusTextInputAfterAnimation(textInputRef.current, 100);
}, [prevDraftMessage, draftMessage]);

The focusTextInputAfterAnimation delay is only available for android. Why this happen now?

As mentioned above, we start the focus once the draft is available. This issue happens after #47866 where they refactor the way we get the draft by directly getting it from useOnyx which seems to be faster.

In #46095 (comment), I explained why focusing too early before the modal is completely hidden causes the problem. In short, it's because the focus trap is still active.

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

We need to apply the same solution as #46095 by using focusComposerWithDelay instead of focusTextInputAfterAnimation.

focusComposerWithDelay(textInputRef.current)(true);

@melvin-bot melvin-bot bot added the Overdue label Aug 30, 2024
Copy link

melvin-bot bot commented Sep 2, 2024

@youssef-lr, @miljakljajic Huh... This is 4 days overdue. Who can take care of this?

@Skalakid
Copy link
Contributor

Skalakid commented Sep 3, 2024

Hello @youssef-lr, sorry for the late response. I was focused on finishing inline images PR and missed the notification about this issue. I can take a look and verify if it's Live Markdown web refactor related bug. For now I'm having trouble with editing a message inside the chat on Android Chrome, so I'm unable to reproduce this issue

Screen.Recording.2024-09-03.at.11.56.47.mov

@miljakljajic
Copy link
Contributor

Not overdue - Waiting for more feedback from @Skalakid

@melvin-bot melvin-bot bot removed the Overdue label Sep 4, 2024
@Skalakid
Copy link
Contributor

Skalakid commented Sep 4, 2024

I can't test it on the dev build, since I can't see Edit message option. However, it appears on staging and I was able to reproduce it also on iOS Safari:

bug.mov

It's hard for me to say if it's connected to the Live Markdown refactor changes. We've changed only the markdown structure that is inside the Live Markdown input component. The outside structure wasn't touched. It can be easily checked by changing the version of the react-native-live-markdown library to 0.1.116 and verifying if it still occurs. Like I said the edit option bug block me in testing so I can't confirm it

@melvin-bot melvin-bot bot added the Overdue label Sep 6, 2024
Copy link

melvin-bot bot commented Sep 9, 2024

@youssef-lr, @miljakljajic Eep! 4 days overdue now. Issues have feelings too...

@Skalakid
Copy link
Contributor

Finally, the bug with message editing has been fixed, and I could test it on the dev environment! I downgraded the version of the react-native-live-markdown to 0.1.116 (the one before the refactor) and the bug still occurs. So it's not connected to the live markdown changes.

Also, I tested @bernhardoj's proposal and it fixes the issue really well

@miljakljajic
Copy link
Contributor

@youssef-lr @Skalakid shall we move forward with @bernhardoj 's proposal then?

@melvin-bot melvin-bot bot removed the Overdue label Sep 10, 2024
@youssef-lr youssef-lr added the External Added to denote the issue can be worked on by a contributor label Sep 10, 2024
@melvin-bot melvin-bot bot changed the title mWeb - Chat - While editing composer doesn't hide and the editing input doesn't get focused [$250] mWeb - Chat - While editing composer doesn't hide and the editing input doesn't get focused Sep 10, 2024
Copy link

melvin-bot bot commented Sep 10, 2024

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

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

melvin-bot bot commented Sep 10, 2024

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

@youssef-lr youssef-lr changed the title [$250] mWeb - Chat - While editing composer doesn't hide and the editing input doesn't get focused [$125] mWeb - Chat - While editing composer doesn't hide and the editing input doesn't get focused Sep 10, 2024
Copy link

melvin-bot bot commented Sep 10, 2024

Upwork job price has been updated to $125

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

melvin-bot bot commented Sep 10, 2024

📣 @ikevin127 🎉 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

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

PR is ready

cc: @ikevin127

@youssef-lr btw, is the price reduction intentional?

@miljakljajic miljakljajic removed the Bug Something is broken. Auto assigns a BugZero manager. label Sep 20, 2024
@miljakljajic miljakljajic removed their assignment Sep 20, 2024
@miljakljajic miljakljajic added the Bug Something is broken. Auto assigns a BugZero manager. label Sep 20, 2024
Copy link

melvin-bot bot commented Sep 20, 2024

Triggered auto assignment to @trjExpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Sep 20, 2024
@miljakljajic
Copy link
Contributor

Going out on parental leave so I've reassigned to another BZ team member. Thank you @trjExpensify

Next steps: PR is still being discussed here

When payment is due:
Upwork Offer to be paid for @ikevin127 : https://www.upwork.com/nx/wm/offer/103900666
@bernhardoj is paid via ND manual requests (per this SO)

@ikevin127
Copy link
Contributor

Update: Awaiting for @youssef-lr to 🟢 Approve and merge PR - currently in talks with PR author to clear up some misunderstandings regarding the issue / implemented fix.

@trjExpensify
Copy link
Contributor

@youssef-lr thoughts on the PR?

@youssef-lr
Copy link
Contributor

Merging now!

@ikevin127
Copy link
Contributor

⚠️ Automation failed here -> this should be on [HOLD for Payment 2024-10-04] according to yesterday’s production deploy from #48973 (comment).

cc @trjExpensify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
Development

No branches or pull requests

8 participants
@youssef-lr @trjExpensify @miljakljajic @Skalakid @bernhardoj @ikevin127 @IuliiaHerets and others