Skip to content

[HOLD for payment 2024-03-05] [$500] Web - Chat - The "Menu" popup can't be closed again, tooltip is visible #35198

Closed

Description

@lanitochka17

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.4.32.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: https://expensify.testrail.io/index.php?/tests/view/4237871&group_by=cases:section_id&group_id=292106&group_order=asc
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:

  1. Send any text in a chat
  2. Hover over the text
  3. Click on the on the "..." button
  4. Click on the on the "..." button again

Expected Result:

It should be able to close it. The tooltip shouldn't be visible while the popup is open

Actual Result:

The "Menu" popup can't be closed by clicking on the "..." button again. The "Menu" tooltip is displayed over the popup

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

Add any screenshot/video evidence

Bug6355165_1706218884107.bandicam_2024-01-25_20-30-25-609.1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0114ccd8b4d932efaf
  • Upwork Job ID: 1750640624626020352
  • Last Price Increase: 2024-01-25
  • Automatic offers:
    • tienifr | Contributor | 28131555

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 25, 2024
  2. melvin-bot commented on Jan 25, 2024

    @melvin-bot
  3. changed the title [-] Web - Chat - The "Menu" popup can't be closed again, tooltip is visible[/-] [+][$500] Web - Chat - The "Menu" popup can't be closed again, tooltip is visible[/+] on Jan 25, 2024
  4. melvin-bot commented on Jan 25, 2024

    @melvin-bot

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

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 25, 2024
  6. melvin-bot commented on Jan 25, 2024

    @melvin-bot

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

  7. ZhenjaHorbach commented on Jan 26, 2024

    @ZhenjaHorbach
    Contributor

    Proposal

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

    Web - Chat - The "Menu" popup can't be closed again, tooltip is visible

    What is the root cause of that problem?

    The main problem with the issue is that we don't have a condition to close the modal
    After each click we re-open the modal window

    onPress: (closePopover, {reportAction, reportID, event, anchor, selection, draftMessage, checkIfContextMenuActive}) => {
    const originalReportID = ReportUtils.getOriginalReportID(reportID, reportAction);
    const originalReport = ReportUtils.getReport(originalReportID);
    showContextMenu(
    CONST.CONTEXT_MENU_TYPES.REPORT_ACTION,
    event as GestureResponderEvent | MouseEvent,
    selection,
    anchor?.current as View | RNText | null,
    reportID,
    reportAction.reportActionID,
    originalReportID,
    draftMessage,
    checkIfContextMenuActive,
    checkIfContextMenuActive,
    ReportUtils.isArchivedRoom(originalReport),
    ReportUtils.chatIncludesChronos(originalReport),
    );

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

    To fix this issue and close modal we can use hideContextMenu
    But for this we need to know the state of the modal window

    For this we can use willAlertModalBecomeVisible from ONYX.MODAL

    We need to get modal values from ONYX

        modal: {
            key: ONYXKEYS.MODAL,
        },
    

    then we need pass modal object in payload for ContextMenuActions

    const payload: ContextMenuActionPayload = {
    reportAction: reportAction as ReportAction,
    reportID,
    draftMessage,
    selection,
    close: () => setShouldKeepOpen(false),
    openContextMenu: () => setShouldKeepOpen(true),
    interceptAnonymousUser,
    anchor,
    checkIfContextMenuActive,
    };

    And then add condition for button

                if (modal.willAlertModalBecomeVisible) {
                    hideContextMenu(...);
                } else {
                    showContextMenu(...);
                }
    

    onPress: (closePopover, {reportAction, reportID, event, anchor, selection, draftMessage, checkIfContextMenuActive}) => {
    const originalReportID = ReportUtils.getOriginalReportID(reportID, reportAction);
    const originalReport = ReportUtils.getReport(originalReportID);
    showContextMenu(
    CONST.CONTEXT_MENU_TYPES.REPORT_ACTION,
    event as GestureResponderEvent | MouseEvent,
    selection,
    anchor?.current as View | RNText | null,
    reportID,
    reportAction.reportActionID,
    originalReportID,
    draftMessage,
    checkIfContextMenuActive,
    checkIfContextMenuActive,
    ReportUtils.isArchivedRoom(originalReport),
    ReportUtils.chatIncludesChronos(originalReport),
    );

    Screen.Recording.2024-01-26.at.02.01.15.mov

    What alternative solutions did you explore? (Optional)

    As alternative we can update ReportActionContextMenu and add new value for ref which will be responsible for the state of the open modal window

    type ReportActionContextMenu = {
    showContextMenu: ShowContextMenu;
    hideContextMenu: (callback?: OnHideCallback) => void;
    showDeleteModal: (reportID: string, reportAction: OnyxEntry<ReportAction>, shouldSetModalVisibility?: boolean, onConfirm?: OnConfirm, onCancel?: OnCancel) => void;
    hideDeleteModal: () => void;
    isActiveReportAction: (accountID: string | number) => boolean;
    instanceID: string;
    runAndResetOnPopoverHide: () => void;
    clearActiveReportAction: () => void;
    contentRef: RefObject<View>;
    };

  8. tienifr commented on Jan 26, 2024

    @tienifr
    Contributor

    Proposal

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

    The "Menu" popup can't be closed by clicking on the "..." button again. The "Menu" tooltip is displayed over the popup

    What is the root cause of that problem?

    In theory, when users press on the more icon again, the popover should be hidden (as what we did with emoji picker,...)

    the logic to handle it here

    if (elementContains(activePopoverRef.current?.ref, e.target) || elementContains(activePopoverRef.current?.anchorRef, e.target)) {
    return;
    }

    when the anchorRef contain the target, that means we don't open the popover again.

    Unfortunately, we handle anchorRef incorrectly in PopoverReportActionContextMenu. The anchorRef is pass to PopoverWithMeasuredContent is always undefined because we did not update this value

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

    1. In showContextMenu we add new param. For example, it's anchor, then update anchorRef to anchor
            anchorRef.current=anchor.current
    
    1. In ContextMenuItem, add new prop anchorRef then pass it to BaseMiniContextMenuItem. For now anchorRef will refer to the Menu button
     <BaseMiniContextMenuItem
                ...
                ref={anchorRef}
            >
    
    1. In BaseReportActionContextMenu, we just need to store the anchorRef of Menu button (index === 3)
        const anchorRef = useRef();
    ...
    <ContextMenuItem
                {...(index===3 ? {anchorRef} : {})}
                onPress={(event) => interceptAnonymousUser(() => contextAction.onPress?.(closePopup, {...payload, anchorRef, event}), contextAction.isAnonymousAction)}
    
    
    1. Update showContextMenu in here and here to receive anchorRef

    Test branch: https://github.com/tienifr/App/tree/fix/35198

    What alternative solutions did you explore? (Optional)

    NA

    Result

    Screen.Recording.2024-01-26.at.14.45.50.mov
  9. melvin-bot commented on Jan 29, 2024

    @melvin-bot

    @puneetlath, @parasharrajat Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  10. parasharrajat commented on Jan 29, 2024

    @parasharrajat
    Member

    Oops, missed it. Gonna review it in sometime.

  11. 8 remaining items

  12. removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 30, 2024
  13. melvin-bot commented on Jan 30, 2024

    @melvin-bot

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

  14. puneetlath commented on Feb 13, 2024

    @puneetlath
    Contributor

    Any updates here? How is this issue going?

  15. parasharrajat commented on Feb 28, 2024

    @parasharrajat
    Member

    PR is merged.

  16. tienifr commented on Mar 1, 2024

    @tienifr
    Contributor

    @puneetlath PR hit production. Melvin is malfunctioning. Please add HOLD for payment label.

  17. changed the title [-][$500] Web - Chat - The "Menu" popup can't be closed again, tooltip is visible[/-] [+][HOLD for payment 2024-03-05] [$500] Web - Chat - The "Menu" popup can't be closed again, tooltip is visible[/+] on Mar 1, 2024
  18. puneetlath commented on Mar 5, 2024

    @puneetlath
    Contributor

    Payment summary:

    Thanks y'all.

  19. parasharrajat commented on May 20, 2024

    @parasharrajat
    Member

    Payment requested as per #35198 (comment)

  20. JmillsExpensify commented on May 31, 2024

    @JmillsExpensify
    Contributor

    $500 approved for @parasharrajat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.ExternalAdded to denote the issue can be worked on by a contributorReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions