Skip to content
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

[HOLD for payment 2024-12-30] [$250] iOS&Android Expense - App does not respond to long tap on receipt placeholder area on expense preview #53697

Open
4 of 8 tasks
IuliiaHerets opened this issue Dec 6, 2024 · 17 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Dec 6, 2024

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: 9.0.72-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, reproducible on both
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Create an expense with receipt.
  4. On the main workspace chat, long tap on the receipt area on the preview.
  5. Note that it responds to long tap and opens menu.
  6. Delete the expense.
  7. Submit an expense without receipt.
  8. On the main workspace chat, long tap on the receipt placeholder area on the preview.

Expected Result:

App will respond to the long tap and open more options menu.

Actual Result:

App does not respond to long tap on the empty receipt placeholder area on the expense preview.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6686288_1733482732185.ScreenRecording_12-06-2024_18-50-53_1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021866480849153052085
  • Upwork Job ID: 1866480849153052085
  • Last Price Increase: 2024-12-10
  • Automatic offers:
    • suneox | Reviewer | 105311644
Issue OwnerCurrent Issue Owner: @bfitzexpensify
@IuliiaHerets IuliiaHerets added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 6, 2024
Copy link

melvin-bot bot commented Dec 6, 2024

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

@bernhardoj
Copy link
Contributor

bernhardoj commented Dec 6, 2024

Edited by proposal-police: This proposal was edited at 2024-12-12 08:04:33 UTC.

Proposal

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

Long press on a empty receipt doesn't show the context menu.

What is the root cause of that problem?

The receipt empty state is wrapped with a pressable.

function ReceiptEmptyState({hasError = false, onPress = () => {}, disabled = false, isThumbnail = false}: ReceiptEmptyStateProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const theme = useTheme();
return (
<PressableWithoutFeedback
accessibilityRole="imagebutton"
accessibilityLabel={translate('receipt.upload')}
onPress={onPress}

This makes it a nested pressable in a ReportPreview or MoneyRequestPreviewContent. The long press doesn't bubble up, which is why we manually handle the report preview long press to show the context menu.

<PressableWithoutFeedback
onPress={openReportFromPreview}
onPressIn={() => DeviceCapabilities.canUseTouchScreen() && ControlSelection.block()}
onPressOut={() => ControlSelection.unblock()}
onLongPress={(event) => showContextMenuForReport(event, contextMenuAnchor, chatReportID, action, checkIfContextMenuActive)}

But we don't do the same for the receipt empty state component.

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

But instead of handling the long press manually for receipt empty state, we can just render a View instead of Pressable if the receipt empty state onPress is undefined. (we need to remove the onPress default value)

function ReceiptEmptyState({hasError = false, onPress = () => {}, disabled = false, isThumbnail = false}: ReceiptEmptyStateProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const theme = useTheme();
return (
<PressableWithoutFeedback
accessibilityRole="imagebutton"
accessibilityLabel={translate('receipt.upload')}
onPress={onPress}

const Wrapper = onPress ? PressableWithoutFeedback : View;
    return (
        <Wrapper

Then, we can remove the receipt image onPress from the ReportPreview and MoneyRequestPreviewContent. (the onPress is only being used by receipt empty state)

<ReportActionItemImages
images={lastThreeReceipts}
total={allTransactions.length}
size={CONST.RECEIPT.MAX_REPORT_PREVIEW_RECEIPTS}
onPress={openReportFromPreview}
/>

<ReportActionItemImages
images={receiptImages}
isHovered={isHovered || isScanning}
size={1}
onPress={shouldDisableOnPress ? undefined : onPreviewPressed}

It was added because the parent pressable onPress isn't triggered when pressing on the receipt empty state. But we can remove it now since we won't use nested pressable anymore for the receipt empty state.

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

When creating the test for this, I found that it behaves differently when running on the test environment. The issue we have here is basically if we have nested pressable, then only the inner pressable will receive the press/long-press event (which was observed first in this PR).

But when I recreate this on the test environment as simple as this:

render(
    <Pressable onLongPress={() => console.log('outer')}>
        <Pressable testID='test'>

        </Pressable>
    </Pressable>
)
fireEvent(await screen.findByTestId('test'), 'longPress');

the outer pressable long press is triggered just fine. So, the unit test can't cover this case.

@melvin-bot melvin-bot bot added the Overdue label Dec 9, 2024
Copy link

melvin-bot bot commented Dec 10, 2024

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

@bfitzexpensify bfitzexpensify added the External Added to denote the issue can be worked on by a contributor label Dec 10, 2024
@melvin-bot melvin-bot bot changed the title iOS&Android Expense - App does not respond to long tap on receipt placeholder area on expense preview [$250] iOS&Android Expense - App does not respond to long tap on receipt placeholder area on expense preview Dec 10, 2024
Copy link

melvin-bot bot commented Dec 10, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 10, 2024
Copy link

melvin-bot bot commented Dec 10, 2024

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

@suneox
Copy link
Contributor

suneox commented Dec 11, 2024

@bernhardoj proposal LGTM. In this case, we can prevent nested pressables

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Dec 11, 2024

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

@blimpich
Copy link
Contributor

@bernhardoj @suneox can we add unit testing to the proposal? Or list a strong reason why we aren't adding unit tests? See this slack post for a reminder on our new policy of unit tests for bugs.

@suneox
Copy link
Contributor

suneox commented Dec 11, 2024

@bernhardoj @suneox can we add unit testing to the proposal? Or list a strong reason why we aren't adding unit tests? See this slack post for a reminder on our new policy of unit tests for bugs.

Currently, our tests focus on unit testing for functions like utilities, Onxy data, Req/Res, .... However, this issue involves user interactions, which we don’t fully support in unit tests yet
But we can explore related code changes and provide manual test scenarios to prevent regression.

@blimpich
Copy link
Contributor

I believe we are able to test user interactions, there just aren't many test suites yet. See below test suites:

  • tests/ui/WorkspaceSwitcherTest.tsx
  • tests/ui/UnreadIndicatorsTest.tsx
  • tests/ui/SwitchToExpensifyClassicTest.tsx
  • tests/ui/PaginationTest.tsx

If there is a technical reason why we can't add unit tests for this I'd like that to be added to the proposal. If it would take too much work than I'd also accept that, but I'd like to know why it takes so much work / isn't possible right now.

@bernhardoj
Copy link
Contributor

I have the same thought as @suneox of this comment.

If there is a technical reason why we can't add unit tests for this I'd like that to be added to the proposal.

I was trying to create the test and found that it's not "possible" to test it. I have added the explanation on the proposal.

@blimpich
Copy link
Contributor

@bernhardoj Thank you for the explanation! Sorry for bugging you both for it but we are really trying to push for more unit tests and its very helpful for me to know why its difficult or what scenarios we aren't able to test right now. Thank you! Lets fix this without new jest tests 👍

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 12, 2024
Copy link

melvin-bot bot commented Dec 12, 2024

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

@bernhardoj
Copy link
Contributor

PR is ready

cc: @suneox

@garrettmknight garrettmknight moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Dec 17, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Dec 23, 2024
@melvin-bot melvin-bot bot changed the title [$250] iOS&Android Expense - App does not respond to long tap on receipt placeholder area on expense preview [HOLD for payment 2024-12-30] [$250] iOS&Android Expense - App does not respond to long tap on receipt placeholder area on expense preview Dec 23, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Dec 23, 2024
Copy link

melvin-bot bot commented Dec 23, 2024

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

Copy link

melvin-bot bot commented Dec 23, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.77-6 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 2024-12-30. 🎊

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

Copy link

melvin-bot bot commented Dec 23, 2024

@suneox @bfitzexpensify @suneox 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]

@garrettmknight garrettmknight moved this from Bugs and Follow Up Issues to Hold for Payment in [#whatsnext] #expense Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
Status: Hold for Payment
Development

No branches or pull requests

5 participants