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

[$1000] Chat - Composer Not focused when clicking on composer box #25892

Closed
2 of 6 tasks
lanitochka17 opened this issue Aug 24, 2023 · 80 comments
Closed
2 of 6 tasks

[$1000] Chat - Composer Not focused when clicking on composer box #25892

lanitochka17 opened this issue Aug 24, 2023 · 80 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff Not a priority Reviewing Has a PR in review

Comments

@lanitochka17
Copy link

lanitochka17 commented Aug 24, 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. Send a message
  3. Click on Edit from the reaction menu
  4. Click on the emoji menu in the edit composer
  5. Now without closing the emoji box click on the main composer

Expected Result:

Clicking on the main composer box focuses the composer

Actual Result:

Clicking on the main composer box focuses on the main composer for a second and then focuses on the edit Composer

Workaround:

Unknown

Platforms:

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

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

Version Number: 1.3.57-1

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

T106-1_EditComposerFocus.mp4
Gravar.2966.mp4

Expensify/Expensify Issue URL:

Issue reported by: @daveSeife

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0161d746e7dbb99cde
  • Upwork Job ID: 1695206421110677504
  • Last Price Increase: 2023-09-15
  • Automatic offers:
    • tienifr | Contributor | 26745373
    • daveSeife | Reporter | 26745374
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 24, 2023

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

@melvin-bot
Copy link

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

Proposal

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

Composer Not focused when clicking on composer box

What is the root cause of that problem?

In the ReportActionItemMessageEdit component, we have a callback when Emoji picker modal is hidden, it will focus back to the editing report message

onModalHide={() => {
setIsFocused(true);
focus(true);
}}

So even if we click focus on the main composer, by above callback, it will focus back to the editing report message

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

In the above onModalHide callback, we need to check if the main composer is focusing, we will early exit and won't focus back to the editing report message

Result:

Screen.Recording.2023-08-25.at.16.49.54.mov

@MitchExpensify MitchExpensify added the External Added to denote the issue can be worked on by a contributor label Aug 25, 2023
@melvin-bot melvin-bot bot changed the title Chat - Composer Not focused when clicking on composer box [$1000] Chat - Composer Not focused when clicking on composer box Aug 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 25, 2023

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

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

melvin-bot bot commented Aug 25, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 25, 2023

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

@tienifr
Copy link
Contributor

tienifr commented Aug 26, 2023

Proposal

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

Composer Not focused when clicking on composer box

What is the root cause of that problem?

When Emoji picker modal is closed, it will focus back to the edit composer regardless of any user interaction:

onModalHide={() => {
setIsFocused(true);
focus(true);
}}

So even if we click focus on the main compose, it will always focus back to the edit compose.

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

Update: As previously discussed here, we should move all ReportActionComposeFocusManager-related codes out of the standalone Composer.

Since PR #24481, we have a way to re-focus on the "right" compose:

  • general composer (including the edit composer): If this is the last composer that was focused on, we want to refocus on this
  • main composer: If there's no last composer that was focused on before, this should be the fallback composer that we need to focus
  1. So there's no need for manual check for currently focused compose because ReportActionFocusManager will handle it. In ReportActionItemMessageEdit:
onModalHide={() => {
    ReportActionComposeFocusManager.focus();
}}
  1. Add the onComposerFocus callback:
onFocus={() => {
    ...
    ReportActionComposeFocusManager.onComposerFocus(() => {
        if (!willBlurTextInputOnTapOutside) {
            return;
        }
        focus(true);
    });
}}
  1. And unsubscribe it using ReportActionComposeFocusManager.clear() on unmount
  2. Remove all ReportActionComposeFocusManager-related codes out of the standalone Composer

@parasharrajat
Copy link
Member

OK. Thanks for the proposals. My intuition is asking to hold this issue as we have done for #23403. Even though solutions might not overlap they seem quite related.

Also, I was checking on #24481 and the implementation doesn't seem very scalable. This is out of the scope of this issue but we can pursue improving that as well.

@rojiphil
Copy link
Contributor

Isn’t this an expected behaviour? When the EmojiPicker is displayed, we do not allow interactions with any other element in Report Screen until it is dismissed. A tap on anywhere else other than the EmojiPicker will hide and bring the focus back on the currently edited message input.

@parasharrajat
Copy link
Member

That was the behavior a few months back but it seems that it is recently changed. I am not sure where.

@melvin-bot melvin-bot bot added the Overdue label Aug 30, 2023
@MitchExpensify
Copy link
Contributor

@parasharrajat do you still think this is the best course of action here?

My intuition is asking to hold this issue as we have done for #23403.

@melvin-bot melvin-bot bot removed the Overdue label Aug 30, 2023
@parasharrajat
Copy link
Member

The reason behind this is that a single PR caused these issues and C+ can pick a more complete solution in #23403 to fix the issue completely. I am monitoring the review of the other issue. If it seems that we are not solving this issue there, I will continue here.

Does that sound good? or do you want me to continue on this issue?

@melvin-bot
Copy link

melvin-bot bot commented Sep 1, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@MitchExpensify
Copy link
Contributor

I am monitoring the review of the other issue. If it seems that we are not solving this issue there, I will continue here.

This sounds great to me! Thank you

@tienifr
Copy link
Contributor

tienifr commented Sep 6, 2023

@parasharrajat As previously discussed here, I updated my proposal to refactor the ReportActionComposeFocusManager codes. I've run through all test cases in related PRs: #23258, #24481 and #23994 and it worked fine.

@MitchExpensify
Copy link
Contributor

Sounds like @tienifr's proposal is updated and ready for you @parasharrajat

@melvin-bot melvin-bot bot removed the Overdue label Sep 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 8, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Sep 8, 2023
@melvin-bot melvin-bot bot removed the Monthly KSv2 label Jul 16, 2024
@isabelastisser
Copy link
Contributor

Bump @parasharrajat, can you please provide an update? Thanks!

@tienifr
Copy link
Contributor

tienifr commented Jul 22, 2024

After PRs related to #24452 were merged, this issue is still reproducible. I'll take a look and update in our PR.

@parasharrajat
Copy link
Member

Thanks @tienifr. Ping me when you have next update.

@parasharrajat
Copy link
Member

@tienifr Any updates?

@isabelastisser
Copy link
Contributor

@tienifr, please provide an update. I will DM you for visibility. Thanks!

@tienifr
Copy link
Contributor

tienifr commented Aug 5, 2024

@isabelastisser we continued our work in the PR ^

@isabelastisser
Copy link
Contributor

@tienifr @parasharrajat will the PR be merged soon?

@parasharrajat
Copy link
Member

@isabelastisser PR is back in review.

@isabelastisser
Copy link
Contributor

No updates yet, I see that we're still reviewing the PR.

@isabelastisser
Copy link
Contributor

@parasharrajat, any news?

@parasharrajat
Copy link
Member

PR awaiting Engineer review.

@parasharrajat
Copy link
Member

It should be ready to be paid in 2 days.

@isabelastisser
Copy link
Contributor

isabelastisser commented Sep 30, 2024

Payment summary:

  • $1000 to @parasharrajat for C+ review - payment pending in NewDot.
  • $1000 to @tienifr for accepted proposal - payment pending in NewDot.
  • $50 to @daveSeife for bug report - paid in Upwork.

@isabelastisser
Copy link
Contributor

@parasharrajat, can you please confirm that the payment summary is correct? Thanks!

@parasharrajat
Copy link
Member

parasharrajat commented Oct 3, 2024

@isabelastisser I think payment for @tienifr would be same as 1K.

@parasharrajat
Copy link
Member

Payment requested as per #25892 (comment)

@isabelastisser
Copy link
Contributor

@parasharrajat, do we need a regression test?

@JmillsExpensify
Copy link

Do we have a BZ checklist for this issue?

@parasharrajat
Copy link
Member

I will add that soon. Please proceed with payment @JmillsExpensify

@JmillsExpensify
Copy link

Sorry I'm unable to, as that would fail our financial controls.

@parasharrajat
Copy link
Member

parasharrajat commented Oct 5, 2024

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:

Regression Test Steps

Web & Desktop
  1. Go to any chat
  2. Switch a message to edit mode (A)
  3. Click Emoji button of A, leave the modal open
  4. Click main composer
  5. Verify that main composer is focused

=====

  1. Click A composer
  2. Right click LHN item >> Mark as unread
  3. Verify that A is focused
  4. Right click another message >> Copy to clipboard
  5. Verify that A is focused

=====

  1. Switch another message to edit mode (B)
  2. Click Emoji button of A >> Close the modal
  3. Verify that A is focused
  4. Repeat step 12-13 with B

=====

  1. Click then Close B composer
  2. Verify that main composer is focused

=====

  1. Click A composer
  2. Delete A from another device/browser
  3. Right click another message >> Copy to clipboard
  4. Verify that main composer is focused
mWeb & Android & iOS
  1. Go to any chat
  2. Switch a message to edit mode (A)
  3. Verify main composer hides
  4. Click Emoji button of A >> Close the modal
  5. Verify that A is focused

=====

  1. Right click a message >> Copy to clipboard
  2. Verify that A is focused

=====

  1. Switch another message to edit mode (B)
  2. Click Emoji button of A >> Close the modal
  3. mWeb & Android: Verify that A is focused
  4. mWeb & Android: Repeat step 9-10 with B
  5. iOS: Verify that B is focused

=====

  1. Press then Close B composer
  2. Verify main composer appears

=====

  1. Click A composer
  2. Delete A from another device/browser
  3. Verify that main composer appears
  4. Right click another message >> Copy to clipboard
  5. mWeb: Verify that main composer is focused

Do you agree 👍 or 👎 ?

@parasharrajat
Copy link
Member

@JmillsExpensify Done.

@JmillsExpensify
Copy link

Thanks! $1,000 approved for @parasharrajat

@isabelastisser
Copy link
Contributor

@JmillsExpensify:

$1000 to @tienifr for accepted proposal - payment PENDING in NewDot.

@isabelastisser
Copy link
Contributor

@johnmlee101, can you please review the test proposal when you have a chance? Thanks!

#25892 (comment)

@johnmlee101
Copy link
Contributor

LGTM!

@isabelastisser
Copy link
Contributor

All set!

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 Internal Requires API changes or must be handled by Expensify staff Not a priority Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

10 participants