Skip to content

[$250] Key Navigation - Pressing CTRL+K in attachment and closing search, leads to different chat #48113

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: 9.0.25-0
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/4891152&group_by=cases:section_id&group_order=asc&group_id=229066
Issue reported by: Applause - Internal Team

Action Performed:

  1. Open the staging.new.expensify website
  2. Open any chat in which an attachment was sent
  3. Click the attachment to open preview modal
  4. Press CTRL+K to open search page
  5. Dismiss the opened search page
  6. Verify if you are redirected to the correct chat

Expected Result:

When the user opens the preview modal of an attachment in any chat, presses CTRL+K and closes the search page, the website should return to the same chat where the user was in

Actual Result:

After the user opens the preview modal of an attachment in any chat, presses CTRL+K and closes the search page, is redirected to a different chat

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

Bug6584145_1724765287823.CTRL_K.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01212d967034d02032
  • Upwork Job ID: 1829648537564304374
  • Last Price Increase: 2024-09-20
  • Automatic offers:
    • DylanDylann | Reviewer | 104123548
    • FitseTLT | Contributor | 104123550
Issue OwnerCurrent Issue Owner: @DylanDylann

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 27, 2024
  2. melvin-bot commented on Aug 27, 2024

    @melvin-bot

    Triggered auto assignment to @kevinksullivan (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.

  3. lanitochka17 commented on Aug 27, 2024

    @lanitochka17
    Author

    @kevinksullivan FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

  4. FitseTLT commented on Aug 27, 2024

    @FitseTLT
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-08-27 20:45:56 UTC.

    Proposal

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

    Key Navigation - Pressing CTRL+K in attachment and closing search, leads to different chat

    What is the root cause of that problem?

    When press the shortcut key Modal.close will be called here

    Modal.close(Session.checkIfActionIsAllowed(() => Navigation.navigate(ROUTES.CHAT_FINDER)));

    This will call the modal onClose here
    if (closeModals.length === 0) {
    return;
    }
    if (onModalClose) {
    closeModals[closeModals.length - 1](isNavigate);
    return;
    }
    closeModals[closeModals.length - 1]();
    }

    the onModalClose in this case is this
    onModalClose={() => {
    Navigation.dismissModal();
    // This enables Composer refocus when the attachments modal is closed by the browser navigation
    ComposerFocusManager.setReadyToFocus();

    Which dismissModal and it will pop the report attachment modal route but this onModalClose will be called again via onModalDidClose (because the modal itself calls the onModalDidClose on its onModalHide)
    function onModalDidClose() {
    if (!onModalClose) {
    return;
    }
    if (closeModals.length) {
    closeTop();

    so another pop on the route will navigate the user to another report

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

    The closeTop here

    closeTop();

    was intended to chain close multiple modals so that the onClose of the next modal will be called on the onModalDidClose of the current modal but we haven't poped the last onClose after calling it in closeTop
    So in closeTop here, we need to pop the last closeModals after it is called becasue there is no need to call the onClose of the topmost modal again after it is called (because calling it by itself means we have closed the modal) here
    function closeTop() {
    if (closeModals.length === 0) {
    return;
    }
    if (onModalClose) {
    closeModals[closeModals.length - 1](isNavigate);
    return;
    }
    closeModals[closeModals.length - 1]();
    }

        if (onModalClose) {
            closeModals[closeModals.length - 1](isNavigate);
            closeModals.pop();
            return;
        }
        closeModals[closeModals.length - 1]();
        closeModals.pop();
    

    What alternative solutions did you explore? (Optional)

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 30, 2024
  6. melvin-bot commented on Aug 30, 2024

    @melvin-bot
  7. changed the title [-]Key Navigation - Pressing CTRL+K in attachment and closing search, leads to different chat[/-] [+][$250] Key Navigation - Pressing CTRL+K in attachment and closing search, leads to different chat[/+] on Aug 30, 2024
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Aug 30, 2024
  9. melvin-bot commented on Aug 30, 2024

    @melvin-bot

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

  10. 38 remaining items

  11. FitseTLT commented on Sep 24, 2024

    @FitseTLT
    Contributor

    @FitseTLT The same bug still happen when reloading page

    Screen.Recording.2024-09-24.at.16.40.04.mov

    @DylanDylann What you found here is a totally different bug that is not occuring because onMOdalHide is being called twice as the main bug here but it is caused by Navigation.goBack being called without fallbackRoute because we haven't passed shouldEnforceFallback true. We have options to solve this

    1. We can use dismissModal with report id here
      Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(report?.reportID ?? '-1'));
                    Navigation.dismissModal(report?.reportID ?? '-1');
    
    

    Because dismissModal correctly handles the case of transaction receipt page here ( and also dismissModal is the most appropriate as we are dismissing a modal)

    case SCREENS.TRANSACTION_RECEIPT:

    2. We can also pass shouldEnforceFallback to goBack

                    Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(report?.reportID ?? '-1'), true);
    
    
  12. melvin-bot commented on Sep 24, 2024

    @melvin-bot

    @CortneyOfstad @DylanDylann this issue is now 4 weeks old, please consider:

    • Finding a contributor to fix the bug
    • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
    • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

    Thanks!

  13. DylanDylann commented on Sep 25, 2024

    @DylanDylann
    Contributor

    Let's go with @FitseTLT's proposal. I the PR phase, please include the change to address this bug

    🎀 👀 🎀 C+ reviewed

  14. melvin-bot commented on Sep 25, 2024

    @melvin-bot

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

  15. removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on Sep 25, 2024
  16. melvin-bot commented on Sep 25, 2024

    @melvin-bot

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

  17. melvin-bot commented on Sep 25, 2024

    @melvin-bot

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

  18. DylanDylann commented on Oct 8, 2024

    @DylanDylann
    Contributor

    @CortneyOfstad This is ready for payment. The PR is deployed to production on 1/10

  19. CortneyOfstad commented on Oct 9, 2024

    @CortneyOfstad
    Contributor

    Payment Summary

    @DylanDylann — paid $250 via Upwork
    @FitseTLT — pid $250 via Upwork

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