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] Typing inserts text to main composer and thread report composer when a popover menu is open #26082

Closed
1 of 6 tasks
kavimuru opened this issue Aug 28, 2023 · 43 comments
Closed
1 of 6 tasks
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

Comments

@kavimuru
Copy link

kavimuru commented Aug 28, 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 chat & Send message
  2. Hover over the sent message > click on 'Reply in thread' > write & send message
  3. Navigate back to the main report where you have sent the message
  4. Right click on the message
  5. Start typing
  6. Open the thread report

Expected Result:

Text should only be entered to the main report composer

Actual Result:

Text is inserted to the main report and the thread report composer too

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.57-2
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

Screencast.from.2023-08-25.21-32-12.mp4
Recording.1516.mp4

Expensify/Expensify Issue URL:
Issue reported by: @Natnael-Guchima
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1692988650725609

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014345451dc41a8cce
  • Upwork Job ID: 1696239303676784640
  • Last Price Increase: 2023-09-04
@kavimuru kavimuru added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. labels Aug 28, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 28, 2023

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

@melvin-bot
Copy link

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

@kavimuru kavimuru removed the Needs Reproduction Reproducible steps needed label Aug 28, 2023
@kavimuru kavimuru changed the title Dev - Typing inserts text to main composer and thread report composer when a popover menu is open Typing inserts text to main composer and thread report composer when a popover menu is open Aug 28, 2023
@kevinksullivan kevinksullivan added the External Added to denote the issue can be worked on by a contributor label Aug 28, 2023
@melvin-bot melvin-bot bot changed the title Typing inserts text to main composer and thread report composer when a popover menu is open [$1000] Typing inserts text to main composer and thread report composer when a popover menu is open Aug 28, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 28, 2023

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

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

melvin-bot bot commented Aug 28, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 28, 2023

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

@kevinksullivan
Copy link
Contributor

Moving forward!

@b4s36t4
Copy link
Contributor

b4s36t4 commented Aug 28, 2023

@kevinksullivan I think there are multiple duplicates for these kind of issue. I think you can close this. Reference communication https://expensify.slack.com/archives/C01GTK53T8Q/p1693211004204119

@kevinksullivan
Copy link
Contributor

Got it, thanks @b4s36t4

@Natnael-Guchima
Copy link

Natnael-Guchima commented Aug 28, 2023

@kevinksullivan @b4s36t4 you might want to take a look at @mountiny's comment on slack:
Kavi Could we create a GH for this one with priority? quite odd bug we should squash fast haha. I think this is a high priority bug.

@b4s36t4
Copy link
Contributor

b4s36t4 commented Aug 28, 2023

@Natnael-Guchima this is a critical bug, but there are duplicate bugs which are almost all to similar to this bug. You can refer to the communication of above thread.

@b4s36t4
Copy link
Contributor

b4s36t4 commented Aug 28, 2023

@kevinksullivan I think what @Natnael-Guchima said is right, althugh 80% of issue is dupe, 20% is having different context which rightly should be solved. Sorry again^^.

@Natnael-Guchima
Copy link

I checked the slack conversation you have shared, if I am not wrong most them reports talk about that text is entered to composer when user types while a modal or popover is opened. This issue is way more weird. Text is entered to multiple reports at a single time when you follow the reproduction step. But the text should be entered to only the main report where focus is applied when writing.

@b4s36t4
Copy link
Contributor

b4s36t4 commented Aug 28, 2023

Yes @Natnael-Guchima Sorry for misunderstanding.

@Natnael-Guchima
Copy link

No problem at all @b4s36t4 👍

@b4s36t4
Copy link
Contributor

b4s36t4 commented Aug 28, 2023

Proposal

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

Typing inserts text to main composer and thread report composer when a popover menu is open

What is the root cause of that problem?

The way we add listeners is causing the issue.

If we see the dependencies of useEffect which add event listeners to focus the input are many(deep level). But one of them is causing issue with the listeners (mount & unmount)

const setUpComposeFocusManager = useCallback(() => {
// This callback is used in the contextMenuActions to manage giving focus back to the compose input.
ReportActionComposeFocusManager.onComposerFocus(() => {
if (!willBlurTextInputOnTapOutside || !isFocused) {
return;
}
focus(false);
}, true);
}, [focus, isFocused]);
.

Here we have a dependency isFocused which will update to false whenever we move out from a report. So this updated causes setUpComposeFocusManager to update which is causes useEffect to add the event listeners.

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

We should only event listeners if we're focused on the navigation.

here we should add a condition to return.

if(!isFocused) return;

or
we could remove isFocused option from the dependencies while that doesn't raise any issue though.

What alternative solutions did you explore? (Optional)

NA

Result

Kapture.2023-08-29.at.02.34.05.mp4

@b4s36t4
Copy link
Contributor

b4s36t4 commented Aug 28, 2023

@kevinksullivan Please re-open the issue. I'm sorry for the wrong info :)

@tienifr
Copy link
Contributor

tienifr commented Aug 29, 2023

Proposal

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

Typing inserts text to main composer and thread report composer when a popover menu is open

What is the root cause of that problem?

In here

}, [focusComposerOnKeyPress, navigation, setUpComposeFocusManager]);

we detect the setUpComposeFocusManager change and run the logic addKeyDownPressListner again. And setUpComposeFocusManager change when isFocused change

Here is the flow:

  • Users open thread: listen keyDownPress for thread composer
  • Users open parent chat: listen keyDownPress for parent composer

then remove keyDownPress listener of thread composer

const unsubscribeNavigationBlur = navigation.addListener('blur', () => KeyDownListener.removeKeyDownPressListner(focusComposerOnKeyPress));

  • isFocused change to false => setUpComposeFocusManager gets changed => run useEffect again => listen keyDownPress for thread composer again

At that time, we have 2 keyDownPressListener callbacks (thread and parent), so when users start type, both composer are updated

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

setUpComposeFocusManager function is meaningless if isFocused is false, because we have the logic early return
In setUpComposeFocusManager we should not check isFocused, this function should run only when the page is focused, so we can remove isFocused

run ReportActionComposeFocusManager.clear(true); when the page is blurred like what we did in clean up function

    useEffect(() => {
        const unsubscribeNavigationBlur = navigation.addListener('blur', () => 
        {
            ReportActionComposeFocusManager.clear(true);
            KeyDownListener.removeKeyDownPressListner(focusComposerOnKeyPress)
        });

At that time, we can make sure the setUpComposeFocusManager can't be run when isFocused is false

Result

Screen.Recording.2023-08-29.at.12.29.20.mov

@mountiny mountiny reopened this Aug 29, 2023
@mountiny
Copy link
Contributor

@rushatgabhane can you please triage this one? Thanks

@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

@joelbettner @kevinksullivan @rushatgabhane this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Sep 11, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

@joelbettner, @kevinksullivan, @rushatgabhane Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

@joelbettner @kevinksullivan @rushatgabhane this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot
Copy link

melvin-bot bot commented Sep 11, 2023

@joelbettner, @kevinksullivan, @rushatgabhane Huh... This is 4 days overdue. Who can take care of this?

@tienifr
Copy link
Contributor

tienifr commented Sep 12, 2023

@joelbettner As I got C+ reviewed here. Can you please help take a look

@kevinksullivan
Copy link
Contributor

Waiting on @joelbettner here

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Sep 13, 2023
@tienifr
Copy link
Contributor

tienifr commented Sep 18, 2023

@joelbettner Can you please help take a look at this GH when you have a chance? Thanks

@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

@joelbettner @kevinksullivan @rushatgabhane this issue is now 3 weeks old. There is one more week left before this issue breaks WAQ and will need to go internal. What needs to happen to get a PR in review this week? Please create a thread in #expensify-open-source to discuss. Thanks!

@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

@joelbettner, @kevinksullivan, @rushatgabhane Huh... This is 4 days overdue. Who can take care of this?

@joelbettner
Copy link
Contributor

joelbettner commented Sep 19, 2023

@rushatgabhane @kevinksullivan I think we should go with @bernhardoj's proposal as it covers more cases and prevents additional buggy behavior.

@melvin-bot melvin-bot bot removed the Overdue label Sep 19, 2023
@kevinksullivan
Copy link
Contributor

@rushatgabhane what do you think?

@melvin-bot melvin-bot bot added the Overdue label Sep 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 25, 2023

@joelbettner @kevinksullivan @rushatgabhane this issue is now 4 weeks old and preventing us from maintaining WAQ, can you:

  • Decide whether any proposals currently meet our guidelines and can be approved as-is today
  • If no proposals meet that standard, please take this issue internal and treat it as one of your highest priorities
  • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

Thanks!

@melvin-bot melvin-bot bot added Internal Requires API changes or must be handled by Expensify staff and removed External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors labels Sep 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 25, 2023

Current assignee @rushatgabhane is eligible for the Internal assigner, not assigning anyone new.

@rushatgabhane
Copy link
Member

@joelbettner sounds good

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

Issue not reproducible during KI retests. (First week)

@melvin-bot melvin-bot bot added the Overdue label Sep 28, 2023
@kevinksullivan
Copy link
Contributor

Closing unless we can reproduce

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
Projects
None yet
Development

No branches or pull requests

10 participants