Skip to content

[Due for payment 2025-05-14] [$250] Reports - Long pressing on an item does not display "Deselect" option #60320

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
2 of 18 tasks
m-natarajan opened this issue Apr 15, 2025 · 57 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production 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

@m-natarajan
Copy link

m-natarajan commented Apr 15, 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: 9.1.28-1
Reproducible in staging?: y
Reproducible in production?: y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @linhvovan29546
Slack conversation (hyperlinked to channel name): #expensify-opensource

Action Performed:

  1. Go to reports
  2. Long press on any item
  3. Press Select
  4. Long press on the same item

Expected Result:

Should show "Deselect"

Actual Result:

Not displayed "Deselect"

Workaround:

unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop
Platforms Tested: On which of our officially supported platforms was this issue tested:
  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Screen.Recording.2025-04-11.at.17.10.41.mov
NSHB7846.1.MP4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021912294803414711441
  • Upwork Job ID: 1912294803414711441
  • Last Price Increase: 2025-04-15
  • Automatic offers:
    • ChavdaSachin | Contributor | 106996720
Issue OwnerCurrent Issue Owner: @NicMendonca
@m-natarajan m-natarajan added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Apr 15, 2025
Copy link

melvin-bot bot commented Apr 15, 2025

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

@Krishna2323
Copy link
Contributor

Krishna2323 commented Apr 15, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-04-15 20:01:04 UTC.

Proposal

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

Reports - Long pressing on an item does not display "Deselect" option

What is the root cause of that problem?

In SearchList component we don't show the text according to the selected item state like we do in SelectionListWithModal.

title={longPressedItem?.isSelected ? translate('common.deselect') : translate('common.select')}
icon={longPressedItem?.isSelected ? EmptySquare : CheckSquare}

<MenuItem
title={translate('common.select')}
icon={Expensicons.Checkmark}
onPress={turnOnSelectionMode}
/>

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

  • Update SearchList's MenuItem to use appropriate text and icon as we do in SelectionListWithModal.
  • Note: We might want to use different icon for deselection state.

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

N/A -- UI issue

What alternative solutions did you explore? (Optional)

Result

@samranahm
Copy link
Contributor

samranahm commented Apr 15, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-04-15 20:04:20 UTC.

Proposal

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

Reports - Long pressing on an item does not display "Deselect" option

What is the root cause of that problem?

Here

<MenuItem
title={translate('common.select')}
icon={Expensicons.Checkmark}
onPress={turnOnSelectionMode}

we just have title={translate('common.select')}

instead of

<MenuItem
title={longPressedItem?.isSelected ? translate('common.deselect') : translate('common.select')}

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

We should update this logic to

<MenuItem
    title={longPressedItem?.isSelected ? translate('common.deselect') : translate('common.select')}
    icon={longPressedItem?.isSelected ? Expensicons.EmptySquare : Expensicons.CheckSquare}

Updating the proposal to meet expected results #60320 (comment)
Now we don't need to implement new title

title={longPressedItem?.isSelected ? translate('common.deselect') : translate('common.select')}

We just need to add a check if (selectionMode?.isEnabled) in handleLongPressRow and make it behave as normal tap, also need to add selectionMode, onCheckboxPress in dependencies array

Just update this

const handleLongPressRow = useCallback(
(item: SearchListItem) => {

logic to

const handleLongPressRow = useCallback(
  (item: SearchListItem) => {
      // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
      if (shouldPreventLongPressRow || !isSmallScreenWidth || item?.isDisabled || item?.isDisabledCheckbox || !isFocused) {
          return;
      }
          if (selectionMode?.isEnabled) {
          onCheckboxPress?.(item);
          return;
      }
      setLongPressedItem(item);
      setIsModalVisible(true);
  },
  [isFocused, isSmallScreenWidth, shouldPreventLongPressRow, selectionMode, onCheckboxPress],
);

We can do the same on Tags and Categories page.

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)

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.

@Krishna2323
Copy link
Contributor

PROPOSAL UPDATED

  • Added a note

@jaydamani

This comment has been minimized.

Copy link
Contributor

⚠️ Thanks for your proposal. Please update it to follow the proposal template, as proposals are only reviewed if they follow that format (note the mandatory sections).

@linhvovan29546
Copy link
Contributor

Proposal

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

Reports - Long pressing on an item does not display "Deselect" option

What is the root cause of that problem?

In SearchList, we currently lack the logic to display the “Deselect” option when an item is already selected

<MenuItem
title={translate('common.select')}
icon={Expensicons.Checkmark}
onPress={turnOnSelectionMode}
/>

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

We should display either the "Select" or "Deselect" option based on longPressedItem?.isSelected, similar to how it’s handled here.

<MenuItem
title={translate('common.select')}
icon={Expensicons.Checkmark}
onPress={turnOnSelectionMode}
/>

                <MenuItem
                    title={longPressedItem?.isSelected ? translate('common.deselect') : translate('common.select')}
                    icon={longPressedItem?.isSelected ? EmptySquare : CheckSquare}
                    onPress={turnOnSelectionMode}
                />

Note

Note for C+: I'm not sure if this is valid as the initial proposal. I reported the bug here and previously provided a solution

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

I think the test is unnecessary here because we already have a test for it. But if we believe it's necessary, we can render the SearchList and simulate a long-press event, similar to how it's done in WorkspaceTagsTest

What alternative solutions did you explore? (Optional)

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.

@NicMendonca NicMendonca added the External Added to denote the issue can be worked on by a contributor label Apr 15, 2025
@melvin-bot melvin-bot bot changed the title Reports - Long pressing on an item does not display "Deselect" option [$250] Reports - Long pressing on an item does not display "Deselect" option Apr 15, 2025
Copy link

melvin-bot bot commented Apr 15, 2025

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

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

melvin-bot bot commented Apr 15, 2025

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

@shubham1206agra
Copy link
Contributor

@Expensify/design Can we have mock for this change? Since it was not present earlier.

@linhvovan29546
Copy link
Contributor

@shubham1206agra Here's an example from the Categories table https://expensify.slack.com/archives/C01GTK53T8Q/p1744378314184679?thread_ts=1744377560.307809&cid=C01GTK53T8Q

@dubielzyk-expensify
Copy link
Contributor

Interesting. Once in select mode after long-pressing I wouldn't expect the same behavior. Curious to hear what @Expensify/design thinks here. We could change it to deselect, but in some ways I feel like the interaction shouldn't be triggered at all?

Maybe it's easy to just change it to deselect though.

@shubham1206agra

This comment has been minimized.

Copy link

melvin-bot bot commented Apr 16, 2025

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

@shubham1206agra
Copy link
Contributor

@linhvovan29546 Thanks for reporting this issue. I checked with the team about the order of proposal and we don't consider proposals made in slack as of now. Link for reference.

@ChavdaSachin
Copy link
Contributor

ChavdaSachin commented Apr 16, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-04-17 05:04:09 UTC.

Proposal

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

Long pressing the item while selection mode is on still opens selection options.

What is the root cause of that problem?

Missing case here

if (shouldPreventLongPressRow || !isSmallScreenWidth || item?.isDisabled || item?.isDisabledCheckbox || !isFocused) {

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

Include the missing case to prevent any item long press interaction here.
Add selectionMode?.isEnabled condition to avoid showing the bottom model when selection is already enabled.

            if (shouldPreventLongPressRow || !isSmallScreenWidth || item?.isDisabled || selectionMode?.isEnabled || item?.isDisabledCheckbox || !isFocused) {

if (shouldPreventLongPressRow || !isSmallScreenWidth || item?.isDisabled || item?.isDisabledCheckbox || !isFocused) {

Also implement the same for other pages like workspace Categories page, Tags page, etc...

if (!turnOnSelectionModeOnLongPress || !isSmallScreenWidth || item?.isDisabled || item?.isDisabledCheckbox || (!isFocused && !isScreenFocused)) {

And of-course some cleanup.

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

NA

What alternative solutions did you explore? (Optional)

Alternatively we could toggle the selection on long press when selection mode is enabled.
To implement which
Modify handleLongPressRow function here for search page.

    const handleLongPressRow =  (item: SearchListItem) => {
        // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
        if (shouldPreventLongPressRow || !isSmallScreenWidth || item?.isDisabled || item?.isDisabledCheckbox || !isFocused) {
            return;
        }
        if(selectionMode?.isEnabled){
            onCheckboxPress?.(item);
            return;
        }
        setLongPressedItem(item);
        setIsModalVisible(true);
    };

const handleLongPressRow = useCallback(
(item: SearchListItem) => {
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
if (shouldPreventLongPressRow || !isSmallScreenWidth || item?.isDisabled || item?.isDisabledCheckbox || !isFocused) {
return;
}
setLongPressedItem(item);
setIsModalVisible(true);
},
[isFocused, isSmallScreenWidth, shouldPreventLongPressRow],
);

And modify handleLongPressRow here for categories, tags, etc.. pages.

    const handleLongPressRow = (item: TItem) => {
        // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
        if (!turnOnSelectionModeOnLongPress || !isSmallScreenWidth || item?.isDisabled || item?.isDisabledCheckbox || (!isFocused && !isScreenFocused)) {
            return;
        }
        if(selectionMode?.isEnabled){
            rest?.onCheckboxPress?.(item);
            return;
        }
        setLongPressedItem(item);
        setIsModalVisible(true);

        if (onLongPressRow) {
            onLongPressRow(item);
        }
    };

const handleLongPressRow = (item: TItem) => {
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
if (!turnOnSelectionModeOnLongPress || !isSmallScreenWidth || item?.isDisabled || item?.isDisabledCheckbox || (!isFocused && !isScreenFocused)) {
return;
}
setLongPressedItem(item);
setIsModalVisible(true);
if (onLongPressRow) {
onLongPressRow(item);
}
};

Look for any other page which might need the same fix.
And perform some cleanup.

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.

@linhvovan29546
Copy link
Contributor

@shubham1206agra Thanks for the review! Just wondering, should we consider an automated test for this case?

@ChavdaSachin
Copy link
Contributor

@shubham1206agra Sorry I am a little bit late to post a proposal.
But my proposal meets the expectations @dubielzyk-expensify posted here #60320 (comment)

Interesting. Once in select mode after long-pressing I wouldn't expect the same behavior. Curious to hear what @Expensify/design thinks here. We could change it to deselect, but in some ways I feel like the interaction shouldn't be triggered at all?

So could you please take a look at my proposal.

@shubham1206agra
Copy link
Contributor

@linhvovan29546 Not really

@dubielzyk-expensify
Copy link
Contributor

We're gonna get alignment in the design team first before we decide on proposals 😄

@shawnborton
Copy link
Contributor

Once in select mode after long-pressing I wouldn't expect the same behavior. Curious to hear what @Expensify/design thinks here. We could change it to deselect, but in some ways I feel like the interaction shouldn't be triggered at all?

I think I generally agree with this? I don't feel strongly but I think this is what I would do. Otherwise yeah, we could just show the deselect option but that feels like overkill when a simple tap of the row would unselect it.

@dubielzyk-expensify
Copy link
Contributor

In some apps long pressing in editing mode just toggles the selection like a normal tap. So that's another possibility. Don't think we need the menu is basically what I'm getting at. Happy to disable or just treat it as a tap.

Let's hear what @dannymcclain thinks too

@ChavdaSachin
Copy link
Contributor

I've asked a query to @shubham1206agra here. waiting for the reply.

@shubham1206agra
Copy link
Contributor

@ChavdaSachin I can't see the question. Can you please recheck?

@melvin-bot melvin-bot bot added the Overdue label May 1, 2025
@mollfpr
Copy link
Contributor

mollfpr commented May 1, 2025

No overdue, the PR is still being worked on.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Overdue Daily KSv2 labels May 1, 2025
@ChavdaSachin
Copy link
Contributor

PR is ready for review.
cc. @shubham1206agra @mollfpr

@allgandalf
Copy link
Contributor

if i remember correctly we have disabled long press on selected items on reports page and transaction rows, isn't that correct @shawnborton ? 🤔

@ChavdaSachin what does your PR do exactly?

@shubham1206agra
Copy link
Contributor

@allgandalf We are marking long press as regular press in different pages in workspace pages (like Distance Rates, Categories, Tags, Taxes and Report Fields)

@allgandalf
Copy link
Contributor

So this has nothing to do with Reports page or transaction row table page?

@allgandalf
Copy link
Contributor

We are marking long press as regular press

I didn't get it honestly, so there would be no action if we long press after this PR?

@ChavdaSachin
Copy link
Contributor

No worri we will include report page as well. Thanks for hoping in to remind us.

@ChavdaSachin
Copy link
Contributor

if i remember correctly we have disabled long press on selected items on reports page and transaction rows, isn't that correct @shawnborton ? 🤔

@ChavdaSachin what does your PR do exactly?

  • This PR aims to treat the long press as simple click when selection Mode is enabled.

I checked the staging - long press on reports page and transaction rows are working as expected (treating long press as regular click when selection mode is enabled).
So no additional change is required here.

cc. @allgandalf @shubham1206agra

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels May 7, 2025
@melvin-bot melvin-bot bot changed the title [$250] Reports - Long pressing on an item does not display "Deselect" option [Due for payment 2025-05-14] [$250] Reports - Long pressing on an item does not display "Deselect" option May 7, 2025
Copy link

melvin-bot bot commented May 7, 2025

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 7, 2025
Copy link

melvin-bot bot commented May 7, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.40-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-05-14. 🎊

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

Copy link

melvin-bot bot commented May 7, 2025

@shubham1206agra @NicMendonca @shubham1206agra 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]

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels May 13, 2025
@NicMendonca
Copy link
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:

  • [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:

  • [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.

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 👎

@shubham1206agra
Copy link
Contributor

@NicMendonca This is not a bug, but a feature change request.

Here is the test.

Pre-requisites: A workspace with -Distance Rates, Categories, Tags, Taxes and Report Fields enabled.

  1. Navigate to workspace -> members page.
  2. Enable selection mode- ie. long press a row and click select when popover menu is visible.
  3. Now long press on few row one by one.
  4. Verify long pressing a row in selection mode acts the same as simple click.(ie. toggles the selection)
  5. Now repeat step 1-4 for workspace -> Distance Rates, workspace -> Categories, workspace -> Tags, workspace -> Taxes and workspace -> Report Fields.

@NicMendonca
Copy link
Contributor

Payment summary

Contributor+: @shubham1206agra - $250 paid via NewDot
Contributor: @ChavdaSachin - $250 paid via Upwork (done ✅ )

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. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
Status: Done
Development

No branches or pull requests