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

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

Closed
1 of 8 tasks
jponikarchuk opened this issue Apr 1, 2025 · 24 comments
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

Comments

@jponikarchuk
Copy link

jponikarchuk commented Apr 1, 2025

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] 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 [email protected]
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
@jponikarchuk jponikarchuk added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Apr 1, 2025
Copy link

melvin-bot bot commented Apr 1, 2025

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.

@lschurr lschurr added the External Added to denote the issue can be worked on by a contributor label Apr 1, 2025
@melvin-bot melvin-bot bot 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 Apr 1, 2025
Copy link

melvin-bot bot commented Apr 1, 2025

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 1, 2025
Copy link

melvin-bot bot commented Apr 1, 2025

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

@linhvovan29546
Copy link
Contributor

linhvovan29546 commented Apr 2, 2025

🚨 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);
                    }}

@ntdiary
Copy link
Contributor

ntdiary commented Apr 4, 2025

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

Image

@linhvovan29546

This comment has been minimized.

@linhvovan29546
Copy link
Contributor

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

@ntdiary
Copy link
Contributor

ntdiary commented Apr 4, 2025

@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?

@linhvovan29546
Copy link
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?

@ntdiary I've retested it, and it works well. Please ignore my first message 😊

@linhvovan29546
Copy link
Contributor

so not sure how this might affect keyboard navigation, can you please share a demo video?

That is a different issue because I can reproduce that on the web as well (though not consistently) without your code.

Screen.Recording.2025-04-04.at.17.34.20.mp4

@ntdiary
Copy link
Contributor

ntdiary commented Apr 4, 2025

@linhvovan29546 's proposal LGTM, and I think it's fine to use a simple firesTouchEvents check here.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Apr 4, 2025

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

Copy link

melvin-bot bot commented Apr 8, 2025

@thienlnam Whoops! This issue is 2 days overdue. Let's get this updated quick!

@lschurr
Copy link
Contributor

lschurr commented Apr 9, 2025

Bump on this one @thienlnam

Copy link

melvin-bot bot commented Apr 10, 2025

@thienlnam Huh... This is 4 days overdue. Who can take care of this?

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 10, 2025
Copy link

melvin-bot bot commented Apr 10, 2025

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

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Daily KSv2 labels Apr 11, 2025
@linhvovan29546
Copy link
Contributor

The PR is ready!
cc @ntdiary

@linhvovan29546
Copy link
Contributor

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

@lschurr
Copy link
Contributor

lschurr commented Apr 21, 2025

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

@lschurr lschurr 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 Apr 21, 2025
@ntdiary
Copy link
Contributor

ntdiary commented Apr 23, 2025

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 👎

@mallenexpensify mallenexpensify removed the Reviewing Has a PR in review label Apr 29, 2025
@melvin-bot melvin-bot bot added the Overdue label Apr 29, 2025
@mallenexpensify
Copy link
Contributor

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

@ntdiary can you propose the regression test steps plz

@mallenexpensify mallenexpensify added Daily KSv2 and removed Weekly KSv2 labels Apr 29, 2025
@melvin-bot melvin-bot bot removed the Overdue label Apr 29, 2025
@ntdiary
Copy link
Contributor

ntdiary commented Apr 30, 2025

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. 😂

@lschurr
Copy link
Contributor

lschurr commented Apr 30, 2025

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

@lschurr lschurr closed this as completed Apr 30, 2025
@JmillsExpensify
Copy link

$250 approved for @ntdiary

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
Projects
None yet
Development

No branches or pull requests

7 participants