Skip to content

[Due for payment 2025-07-01] [$250] mWeb - Reports - Report preview remain highlighted when closed using device´s back button. #63685

Closed

Description

@nlemma

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.1.60-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: N/A
Email or phone of affected tester (no customers): ibellicotest+985@gmail.com
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 - Android 12 - Chrome
App Component: Search

Action Performed:

Prerequisite: Account has at least one workspace available.

  1. Open the staging.new.expensify.com website.
  2. Open any workspace chat.
  3. Submit a manual expense.
  4. Navigate to "Reports"
  5. Tap on the bookmark icon and select "Reports"
  6. Open the report of the just created expense.
  7. Return using device´s back button.
  8. Note that report preview remains highlighted after returning.

Expected Result:

Report preview, shouldn´t remain highlighted when user returns to reports list.

Actual Result:

When user opens an expense report from "Reports" section and returns using device´s back button, the report preview remains constantly highlighted.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6852164_1749192339239.Lighted.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021932821543208672181
  • Upwork Job ID: 1932821543208672181
  • Last Price Increase: 2025-06-11
  • Automatic offers:
    • truph01 | Contributor | 107692064
Issue OwnerCurrent Issue Owner: @abekkala

Activity

  1. added
    Daily
    Bug
    on Jun 6, 2025
  2. melvin-bot commented on Jun 6, 2025

    @melvin-bot

    Triggered auto assignment to @abekkala (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. truph01 commented on Jun 7, 2025

    @truph01
    Contributor

    Proposal

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

    • When a user opens an expense report from the "Reports" section and navigates back using the device's back button, the report preview remains visibly highlighted, even though it should not be.

    What is the root cause of that problem?

    • We use the useHover hook to track hover state and apply the appropriate active styles, as shown here:

      const bgActiveStyles = useMemo(() => {
      if (isSelected) {
      return styles.activeComponentBG;
      }
      if (hovered || isParentHovered) {
      return styles.hoveredComponentBG;
      }
      }, [hovered, isParentHovered, isSelected, styles.activeComponentBG, styles.hoveredComponentBG]);

    • On touchscreen devices, although a hover action doesn't technically occur, the hovered state is still set to true, which results in incorrect active styling. Why is hovered being set on touch devices?

    • In the useHover hook, the onMouseEnter event is expected to trigger only when a mouse pointer enters an element. However, on touch devices, onMouseEnter can be erroneously triggered by a tap, causing hovered to be set to true even though no hover action has occurred.

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

    • In the following lines of the useHover hook:

      onMouseEnter: () => setHovered(true),
      onMouseLeave: () => setHovered(false),

      We should add a check for !canUseTouchScreen before calling the setter function, similar to what we already do here:

      onMouseEnter={() => !canUseTouchScreen && setShouldShowArrows(true)}
      onMouseLeave={() => !canUseTouchScreen && setShouldShowArrows(false)}

      This will prevent touch events from incorrectly triggering hover behavior.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    • None

    What alternative solutions did you explore? (Optional)

    • Besides canUseTouchScreen, we can use hasHoverSupport function to check whether the current platform can be hovered.
  4. dmkt9 commented on Jun 9, 2025

    @dmkt9
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-06-09 04:29:42 UTC.

    Proposal

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

    When user opens an expense report from "Reports" section and returns using device´s back button, the report preview remains constantly highlighted.

    What is the root cause of that problem?

    1. Because TransactionItemRow uses the useHover hook to add styles to the element.
      const {hovered, bind: bindHover} = useHover();
      const bgActiveStyles = useMemo(() => {
      if (isSelected) {
      return styles.activeComponentBG;
      }
      if (hovered || isParentHovered) {
      return styles.hoveredComponentBG;
      }
      }, [hovered, isParentHovered, isSelected, styles.activeComponentBG, styles.hoveredComponentBG]);
    2. And within this hook, mouse events are used to track the hover event.
      onMouseEnter: () => setHovered(true),
      onMouseLeave: () => setHovered(false),
    3. However, on mobile devices, after clicking and navigating away, the onMouseLeave event is not triggered, which means hovered remains true and the style stays applied when going back.

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

    Ensure that after clicking and navigating away, hovered is reset, while all the original behavior is maintained:

    const [hovered, setHovered] = useState(false);

    const isFocused = useIsFocused();
    // eslint-disable-next-line rulesdir/prefer-early-return
    useEffect(() => {
        if (!isFocused) {
            setHovered(false);
        }
    }, [isFocused]);

    If we only want to reset on mobile, we can add a check in useEffect.

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    N/A

    What alternative solutions did you explore? (Optional)

    N/A

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  5. melvin-bot commented on Jun 10, 2025

    @melvin-bot

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

  6. added
    External
    on Jun 11, 2025
  7. changed the title [-]mWeb - Reports - Report preview remain highlighted when closed using device´s back button.[/-] [+][$250] mWeb - Reports - Report preview remain highlighted when closed using device´s back button.[/+] on Jun 11, 2025
  8. melvin-bot commented on Jun 11, 2025

    @melvin-bot
  9. added
    Help Wanted
    on Jun 11, 2025
  10. melvin-bot commented on Jun 11, 2025

    @melvin-bot

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

  11. 13 remaining items

  12. truph01 commented on Jun 17, 2025

    @truph01
    Contributor

    @ahmedGaber93 PR is ready

  13. abekkala commented on Jun 18, 2025

    @abekkala
    Contributor

    @ahmedGaber93 have you began the PR review?

  14. ahmedGaber93 commented on Jun 19, 2025

    @ahmedGaber93
    Contributor

    @abekkala Done.

  15. added
    Weekly
    Awaiting Payment
    and removed
    Weekly
    on Jun 24, 2025
  16. changed the title [-][$250] mWeb - Reports - Report preview remain highlighted when closed using device´s back button.[/-] [+][Due for payment 2025-07-01] [$250] mWeb - Reports - Report preview remain highlighted when closed using device´s back button.[/+] on Jun 24, 2025
  17. removed
    Reviewing
    on Jun 24, 2025
  18. melvin-bot commented on Jun 24, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  19. melvin-bot commented on Jun 24, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.70-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-07-01. 🎊

    For reference, here are some details about the assignees on this issue:

  20. melvin-bot commented on Jun 24, 2025

    @melvin-bot

    @ahmedGaber93 @abekkala @ahmedGaber93 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  21. ahmedGaber93 commented on Jul 1, 2025

    @ahmedGaber93
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other: Applause Internal Team
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: https://github.com/Expensify/App/pull/37199/files#r2176490113

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: N/A

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    This is a straight forward fix, and I don't think we need a regression test here.

  22. abekkala commented on Jul 1, 2025

    @abekkala
    Contributor

    PAYMENT SUMMARY FOR JUL 01

    • Fix: @truph01 [$250] payment sent and contract ended - thank you! 🎉
    • PR Review: @ahmedGaber93 [$250] payment via NewDot
      thank you! 🎉
  23. JmillsExpensify commented on Jul 11, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @ahmedGaber93

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

Metadata

Metadata

Labels

Awaiting PaymentBugExternalWeekly

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions