Skip to content

[Due for payment 2025-04-23] [$250] mWeb - Reports - With multiple expenses long pressing 1st expense page moves & select option shown #59420

Closed

Description

@jponikarchuk

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: V9 1.21-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
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): Slottwo1 pfd@gmail.com
Issue reported by: Applause Internal Team
Device used: Redminote 10s android 13
App Component: User Settings

Action Performed:

  1. Go to https://staging.new.expensify.com/home
  2. Login with account with many expenses
  3. Tap reports
  4. Long press the first expense
  5. Note expense is moved up and select option is not displayed
  6. Try to long press & select the last expense by scrolling down the page
  7. Note select option is displayed

Expected Result:

In reports page with multiple expenses, long pressing the 1st expense, deselect option must be displayed without moving up the page.

Actual Result:

In reports page with multiple expenses, long pressing the 1st expense, deselect select option is not shown. Page is moved up and long pressing on second time only select option is displayed.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6784750_1743110346795.Dvnb8264_1_.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021907125974219770626
  • Upwork Job ID: 1907125974219770626
  • Last Price Increase: 2025-04-01
  • Automatic offers:
    • linhvovan29546 | Contributor | 106871839
Issue OwnerCurrent Issue Owner: @lschurr

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Apr 1, 2025
  2. melvin-bot commented on Apr 1, 2025

    @melvin-bot

    Triggered auto assignment to @lschurr (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. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Apr 1, 2025
  4. changed the title [-]mWeb - Reports - With multiple expenses long pressing 1st expense page moves & select option shown[/-] [+][$250] mWeb - Reports - With multiple expenses long pressing 1st expense page moves & select option shown[/+] on Apr 1, 2025
  5. melvin-bot commented on Apr 1, 2025

    @melvin-bot
  6. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Apr 1, 2025
  7. melvin-bot commented on Apr 1, 2025

    @melvin-bot

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

  8. linhvovan29546 commented on Apr 2, 2025

    @linhvovan29546
    Contributor

    🚨 Edited by proposal-police: This proposal was edited at 2025-04-02 08:48:14 UTC.

    Proposal

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

    mWeb - Reports - With multiple expenses long pressing 1st expense page moves & select option shown

    What is the root cause of that problem?

    When long-pressing an item on the search page, the onFocus event is triggered, calling setFocusedIndex(). This causes onFocusedIndexChange to fire and invoke scrollToIndex, leading to an unintended scroll when the selection modal appears.

    onFocusedIndexChange: (index: number) => {
    scrollToIndex(index);
    },

    We had logic in SelectionList to prevent this issue on mobile using isMobileChrome(), but in PR #57549, we migrated to FlatList and missed that logic, which led to the issue in the OP.
    // Ignore the focus if it's caused by a touch event on mobile chrome.
    // For example, a long press will trigger a focus event on mobile chrome.
    shouldIgnoreFocus={isMobileChrome() && isScreenTouched}

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

    We can bring back the missing logic to SearchList and only apply for web platform:

       const [isScreenTouched, setIsScreenTouched] = useState(false);
        
            const touchStart = () => setIsScreenTouched(true);
            const touchEnd = () => setIsScreenTouched(false);
    
               const shouldIgnoreFocus= isMobileChrome() && isScreenTouched
               useEffect(() => {
                if (!canUseTouchScreen()) {
                    return;
                }
        
                // We're setting `isScreenTouched` in this listener only for web platforms with touchscreen (mWeb) where
                // we want to dismiss the keyboard only when the list is scrolled by the user and not when it's scrolled programmatically.
                document.addEventListener('touchstart', touchStart);
                document.addEventListener('touchend', touchEnd);
        
                return () => {
                    document.removeEventListener('touchstart', touchStart);
                    document.removeEventListener('touchend', touchEnd);
                };
            }, []);
    const shouldIgnoreFocus=isMobileChrome() && isScreenTouched
    

    Then, in the onFocus event, we return early if shouldIgnoreFocus is true:

    onFocus={(event: NativeSyntheticEvent<ExtendedTargetedEvent>) => {
    // Prevent unexpected scrolling on mobile Chrome after the context menu closes by ignoring programmatic focus not triggered by direct user interaction.
    if (isMobileChrome() && event.nativeEvent && !event.nativeEvent.sourceCapabilities) {
    return;
    }
    setFocusedIndex(index);
    }}

                        onFocus={(event: NativeSyntheticEvent<ExtendedTargetedEvent>) => {
                            if (shouldIgnoreFocus) {
                                return; 
                            }
    ... other
                        }}

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

    None – this is a UI bug specific to mobile Chrome.

    What alternative solutions did you explore? (Optional)

    We could simplify the solution like this (based on firesTouchEvents)

                        onFocus={(event: NativeSyntheticEvent<ExtendedTargetedEvent>) => {
                            // Prevent unexpected scrolling on mobile Chrome after the context menu closes by ignoring programmatic focus not triggered by direct user interaction.
                            if (isMobileChrome() && event.nativeEvent) {
                                if( !event.nativeEvent.sourceCapabilities){
                                    return
                                }
                                if(event.nativeEvent.sourceCapabilities.firesTouchEvents){
                                    return
                                }
                            }
                            setFocusedIndex(index);
                        }}
  9. ntdiary commented on Apr 4, 2025

    @ntdiary
    Contributor

    @linhvovan29546, your RCA LGTM, and I feel we could simplify the solution like this (based on firesTouchEvents)

    Image
  10. linhvovan29546 commented on Apr 4, 2025

    @linhvovan29546
  11. linhvovan29546 commented on Apr 4, 2025

    @linhvovan29546
    Contributor

    @ntdiary Thank you for the suggestion! That works well. I've updated the proposal to include alternative solutions #59420 (comment)

  12. ntdiary commented on Apr 4, 2025

    @ntdiary
    Contributor

    @linhvovan29546, are you saying the focus event isn't triggered by keyboard navigation? The changes are limited to the onFocus callback, so not sure how this might affect keyboard navigation, can you please share a demo video?

  13. 16 remaining items

  14. linhvovan29546 commented on Apr 11, 2025

    @linhvovan29546
    Contributor

    The PR is ready!
    cc @ntdiary

  15. linhvovan29546 commented on Apr 21, 2025

    @linhvovan29546
    Contributor

    FYI: The PR was deployed to production 4 days ago, and the due date for payment is 2025-04-23.

  16. lschurr commented on Apr 21, 2025

    @lschurr
    Contributor

    Looks like the automation didn't work. Thanks @linhvovan29546

  17. changed the title [-][$250] mWeb - Reports - With multiple expenses long pressing 1st expense page moves & select option shown[/-] [+][Due for payment 2025-04-23] [$250] mWeb - Reports - With multiple expenses long pressing 1st expense page moves & select option shown[/+] on Apr 21, 2025
  18. ntdiary commented on Apr 23, 2025

    @ntdiary
    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:
    • [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/57549/files#r2056196736

    • [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.
      No need, as we should already have a regression test

    Regression Test Proposal Template
    • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

      Link to issue:

    Regression Test Proposal

    Precondition:

    Test:

    Do we agree 👍 or 👎

  19. mallenexpensify commented on Apr 29, 2025

    @mallenexpensify
    Contributor

    Contributor: @linhvovan29546 paid $250 via Upwork
    Contributor+: @ntdiary due $250 via NewDot

    @ntdiary can you propose the regression test steps plz

  20. ntdiary commented on Apr 30, 2025

    @ntdiary
    Contributor

    No need, as we should already have a regression test

    @ntdiary can you propose the regression test steps plz

    @mallenexpensify, do you think it's better to create a new regression test? I noticed there's already a similar one earlier, It's actually the same, just described differently. 😂

  21. lschurr commented on Apr 30, 2025

    @lschurr
    Contributor

    I think we can close if we already have a regression test for this.

  22. JmillsExpensify commented on May 5, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @ntdiary

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions