You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2025-04-23] [$250] mWeb - Reports - With multiple expenses long pressing 1st expense page moves & select option shown #59420
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
Note expense is moved up and select option is not displayed
Try to long press & select the last expense by scrolling down the page
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.
🚨 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.
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.
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:
// Prevent unexpected scrolling on mobile Chrome after the context menu closes by ignoring programmatic focus not triggered by direct user interaction.
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);}}
@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?
[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.
@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. 😂
Activity
melvin-bot commentedon 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.[-]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[/+]melvin-bot commentedon Apr 1, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021907125974219770626
melvin-bot commentedon Apr 1, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ntdiary (
External)linhvovan29546 commentedon 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.
App/src/components/Search/SearchList.tsx
Lines 205 to 207 in c3451e1
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.
App/src/components/SelectionList/index.tsx
Lines 74 to 76 in c3451e1
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:
App/src/components/Search/SearchList.tsx
Line 118 in c3451e1
Then, in the onFocus event, we return early if shouldIgnoreFocus is true:
App/src/components/Search/SearchList.tsx
Lines 282 to 288 in c3451e1
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)
ntdiary commentedon Apr 4, 2025
@linhvovan29546, your RCA LGTM, and I feel we could simplify the solution like this (based on
firesTouchEvents)linhvovan29546 commentedon Apr 4, 2025
linhvovan29546 commentedon Apr 4, 2025
@ntdiary Thank you for the suggestion! That works well. I've updated the proposal to include alternative solutions #59420 (comment)
ntdiary commentedon Apr 4, 2025
@linhvovan29546, are you saying the
focusevent isn't triggered by keyboard navigation? The changes are limited to theonFocuscallback, so not sure how this might affect keyboard navigation, can you please share a demo video?16 remaining items
linhvovan29546 commentedon Apr 11, 2025
The PR is ready!
cc @ntdiary
linhvovan29546 commentedon Apr 21, 2025
FYI: The PR was deployed to production 4 days ago, and the due date for payment is 2025-04-23.
lschurr commentedon Apr 21, 2025
Looks like the automation didn't work. Thanks @linhvovan29546
[-][$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[/+]ntdiary commentedon Apr 23, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[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 commentedon Apr 29, 2025
Contributor: @linhvovan29546 paid $250 via Upwork
Contributor+: @ntdiary due $250 via NewDot
@ntdiary can you propose the regression test steps plz
ntdiary commentedon Apr 30, 2025
@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 commentedon Apr 30, 2025
I think we can close if we already have a regression test for this.
JmillsExpensify commentedon May 5, 2025
$250 approved for @ntdiary