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-12-13][$500] Mention(@) and emoji(:) popup does not close when dragging a file #30153

Closed
2 of 6 tasks
kbecciv opened this issue Oct 23, 2023 · 41 comments
Closed
2 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@kbecciv
Copy link

kbecciv commented Oct 23, 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!


Version Number: 1.3.88.1
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
Expensify/Expensify Issue URL:
Issue reported by: @daveSeife
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1697872753258699

Action Performed:

  1. Open any Chat
  2. Write @ or : and any emoji name, While the popup is open Drag a file onto the chat
    Notice the popup does not dismiss

Expected Result:

Popup closes when dragging a file

Actual Result:

Popup does not close when dragging a file

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

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
t4popupDragingFile.MacChrome.mp4
Recording.5106.mp4
MacOS: Desktop
t4PupupDragingfile.MacDesktop.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01ebdf425a95b3b890
  • Upwork Job ID: 1716273483340058624
  • Last Price Increase: 2023-10-30
  • Automatic offers:
    • cubuspl42 | Reviewer | 27579707
    • ishpaul777 | Contributor | 27579709
    • daveSeife | Reporter | 27579710
@kbecciv kbecciv 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 Oct 23, 2023
@melvin-bot melvin-bot bot changed the title Mention(@) and emoji(:) popup does not close when dragging a file [$500] Mention(@) and emoji(:) popup does not close when dragging a file Oct 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

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

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

melvin-bot bot commented Oct 23, 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

@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

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

@s-alves10
Copy link
Contributor

s-alves10 commented Oct 23, 2023

Proposal

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

Suggestions popup doesn't close when dragging a file

What is the root cause of that problem?

We do nothing to close suggestions popup when dragging a file

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

  1. Change the updateShouldShowSuggestionMenuToFalse function to receive shouldShow argument
    Update
    const updateShouldShowSuggestionMenuToFalse = useCallback(() => {
    setSuggestionValues((prevState) => {
    if (prevState.shouldShowSuggestionMenu) {
    return {...prevState, shouldShowSuggestionMenu: false};
    }
    return prevState;
    });
    }, []);

    const updateShouldShowSuggestionMenuToFalse = useCallback(() => {
    setSuggestionValues((prevState) => {
    if (prevState.shouldShowSuggestionMenu) {
    return {...prevState, shouldShowSuggestionMenu: false};
    }
    return prevState;
    });
    }, []);

to

    const updateShouldShowSuggestionMenuToFalse = useCallback((shouldShow) => {
        setSuggestionValues((prevState) => {
            if (prevState.shouldShowSuggestionMenu !== shouldShow) {
                return {...prevState, shouldShowSuggestionMenu: shouldShow};
            }
            return prevState;
        });
    }, []);
  1. Update
    const updateShouldShowSuggestionMenuToFalse = useCallback(() => {
    suggestionEmojiRef.current.updateShouldShowSuggestionMenuToFalse();
    suggestionMentionRef.current.updateShouldShowSuggestionMenuToFalse();
    }, []);

    to
    const updateShouldShowSuggestionMenuToFalse = useCallback((shouldShow = false) => {
        suggestionEmojiRef.current.updateShouldShowSuggestionMenuToFalse(shouldShow);
        suggestionMentionRef.current.updateShouldShowSuggestionMenuToFalse(shouldShow);
    }, []);
  1. Add the following code to Suggestions
    const {isDraggingOver} = useContext(DragAndDropContext);

    ...
    useEffect(() => {
        updateShouldShowSuggestionMenuToFalse(!isDraggingOver);
    }, [isDraggingOver])

This works as expected

Result
30153.mp4

What alternative solutions did you explore? (Optional)

@c3024
Copy link
Contributor

c3024 commented Oct 23, 2023

Proposal

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

Mention and emoji suggestions appear over the drop screen when dragging a file on to the composer with suggestions open.

What is the root cause of that problem?

I think the expected behaviour should be not necessarily to close the suggestions popup. Instead we want the 'Drop to Upload' screen to be over the suggestions popup.

We are using this host here to show suggestions.


Suggestions are wrapped inside Portal with this host name here
<Portal hostName="suggestions">
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<BaseAutoCompleteSuggestions {...props} />
</Portal>

but here we are porting it to the body
ReactDOM.createPortal(<View style={StyleUtils.getBaseAutoCompleteSuggestionContainerStyle({left, width, bottom})}>{componentToRender}</View>, document.querySelector('body'))

so the suggestions popover appears over the "Drop to Upload" screen.

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

I think we should remove createPortal in the return of index.js of AutoCompleteSuggestions specified above and wrap the View with Portal like this

<Portal hostName="suggestions"><View style={StyleUtils.getBaseAutoCompleteSuggestionContainerStyle({left, width, bottom})}>{componentToRender}</View></Portal>

What alternative solutions did you explore? (Optional)

We might wrap the BaseAutoCompleteSuggestions with Portal and remove createPortal in the index.js of AutoCompleteSuggestions specified above.
With this change, the componentToRender and return of index.js of AutoCompleteSuggestions will be something like this.

const componentToRender = (
        <Portal hostName="suggestions">
          <BaseAutoCompleteSuggestions
              // eslint-disable-next-line react/jsx-props-no-spreading
              {...props}
              ref={containerRef}
          />
        </Portal>
    );

    return (
        Boolean(width) &&
        <View style={StyleUtils.getBaseAutoCompleteSuggestionContainerStyle({left, width, bottom})}>{componentToRender}</View>
    );
Result
Screen.Recording.2023-10-23.at.12.29.59.PM.mov

@cubuspl42
Copy link
Contributor

@s-alves10 Would you publish your branch?

@c3024
Copy link
Contributor

c3024 commented Oct 23, 2023

@cubuspl42

Is the suggestions popup closing the expected behaviour?

I think it need not close. In my opinion, the expected behaviour should be that the drop screen should be over the suggestions popup.

@s-alves10
Copy link
Contributor

@dukenv0307
Copy link
Contributor

dukenv0307 commented Oct 23, 2023

Proposal

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

Mention(@) and emoji(:) popup does not close when dragging a file

What is the root cause of that problem?

We don't have the logic to close the suggestion popup when we drag a file

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

In Suggestions.js, we can get isDraggingOver from DragAndDropContext and use usePrevious to store the previous state of isDraggingOver. And then add a useEffect to close the suggestion popup when isDraggingOver is changed to true

useEffect(() => {
    if (prevIsDraggingOver === isDraggingOver) {
        return;
    }
    if (isDraggingOver) {
        updateShouldShowSuggestionMenuToFalse();
    }
}, [isDraggingOver, prevIsDraggingOver])

After we send the attachment or close the preview modal, the composer will be focused again and the popup will be opened, so we don't need to update shouldShow state of suggestion popup again.

What alternative solutions did you explore? (Optional)

@ishpaul777
Copy link
Contributor

this has same root cause(we dont hide popover when dragging over) as #26553 which was decided to close.

@s-alves10
Copy link
Contributor

@ishpaul777

I think this is apparently a bug and needs to be fixed

cc @cubuspl42

@cubuspl42
Copy link
Contributor

@ishpaul777 Thanks for referencing the earlier issue, as it's always good to know that this was considered before.

I do agree with @s-alves10 that this is an obvious visual glitch.

@ishpaul777
Copy link
Contributor

ishpaul777 commented Oct 23, 2023

Proposal

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

Mention(@) and emoji(:) popup does not close when dragging a file

What is the root cause of that problem?

We are not closing the Popover when a file is dragging, case not handled

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

To resolve the issue, Hiding only suggestion and emojipopover when dragover would solve the issue but it would be not enough as there are other popoover which can cause the same issue here
IMO we should also apply a global/consistent solution, need to close any popover when a file is dragging over.
Add this to PopoverProvider

React.useEffect(() => {
        // hide popover on drag enter
        const listener = () => {
            closePopover();
        };
        document.addEventListener('dragenter', listener);
        return () => {
            document.removeEventListener('dragenter', listener);
        };
    }, [closePopover]);

Note: This will hide any popover menu visibile on Drag enter

Screen.Recording.2023-09-03.at.12.23.11.AM.mov

@s-alves10
Copy link
Contributor

@c3024

We need to use portal for the issue #27036

@dukenv0307

Mention suggestions wouldn't show when cancelling the dragging in your solution

@ishpaul777

I think your solution would work for other popovers, but we need to show suggestions again after dragging is cancelled or completed

cc @cubuspl42

@c3024
Copy link
Contributor

c3024 commented Oct 23, 2023

I am not suggesting to remove the portal altogether.

I think we should use the host "suggestions" instead of document body for the portal.

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

@cubuspl42 I skimmed the issue and looks like we don't quite have a proposal we want to move forward with, is that correct? Are there any that are close and could be accepted with some changes?

@melvin-bot melvin-bot bot removed the Overdue label Oct 26, 2023
@cubuspl42
Copy link
Contributor

@sonialiap

Sorry for the lack of updates. I think we'll be able to pick a proposal from the existing ones, possibly with small adjustments.

@ishpaul777

It's a good observation that the context menu is also affected! Would it be possible to use our DragAndDropContext in your solution, instead of subscribing to the DOM events directly?

@s-alves10
Copy link
Contributor

@cubuspl42

Will you let me know your thoughts on #30153 (comment)?

@cubuspl42
Copy link
Contributor

Mention suggestions wouldn't show when cancelling the dragging in your solution

I think your solution would work for other popovers, but we need to show suggestions again after dragging is cancelled or completed

I don't feel like it's a necessity to automatically show the suggestion popup after the drag is finished. I would personally prefer it if it didn't open automatically; still, both behaviors sound acceptable.

@s-alves10
Copy link
Contributor

@cubuspl42

I'm saying the case where dragging is cancelled. The composer would get focused again but the suggestion popup doesn't show. We have been treating this as a bug up to now. A similar issue is #22447.

Copy link

melvin-bot bot commented Nov 6, 2023

Triggered auto assignment to @joelbettner, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

Copy link

melvin-bot bot commented Nov 6, 2023

@cubuspl42 @joelbettner @sonialiap 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 Nov 8, 2023
@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Nov 8, 2023
Copy link

melvin-bot bot commented Nov 8, 2023

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

Copy link

melvin-bot bot commented Nov 8, 2023

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

Copy link

melvin-bot bot commented Nov 8, 2023

📣 @daveSeife 🎉 An offer has been automatically sent to your Upwork account for the Reporter role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job

@melvin-bot melvin-bot bot removed the Overdue label Nov 8, 2023
@joelbettner
Copy link
Contributor

@cubuspl42 The proposal from @ishpaul777 looks good. I assigned him to this issue.

@ishpaul777
Copy link
Contributor

ishpaul777 commented Nov 8, 2023

A draft PR will be up by tomorrow. (thursday)

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Nov 12, 2023
@DylanDylann
Copy link
Contributor

@sonialiap I reported this bug before here #27564. Could you help to update reporter on the OP

Copy link

melvin-bot bot commented Dec 5, 2023

This issue has not been updated in over 15 days. @cubuspl42, @joelbettner, @sonialiap, @ishpaul777 eroding to Monthly issue.

P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

@cubuspl42
Copy link
Contributor

PR is merged

@sonialiap
Copy link
Contributor

sonialiap commented Dec 15, 2023

Automation didn't run. The PR went to production on Dec 6, updating issue title to payment on Dec 13 and making payments

@sonialiap sonialiap added Weekly KSv2 and removed Monthly KSv2 labels Dec 15, 2023
@sonialiap sonialiap changed the title [$500] Mention(@) and emoji(:) popup does not close when dragging a file [HOLD for payment 2023-12-13][$500] Mention(@) and emoji(:) popup does not close when dragging a file Dec 15, 2023
@sonialiap sonialiap added Daily KSv2 and removed Weekly KSv2 labels Dec 15, 2023
@sonialiap
Copy link
Contributor

sonialiap commented Dec 18, 2023

@ishpaul777 contributor $500 paid ✔️
@cubuspl42 reviewer $500 paid ✔️
@DylanDylann bug report $50 - paid ✔️

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 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

9 participants