Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.34k stars 2.77k forks source link

[$250] Web - Debug - RHP tabs can be swiped #49483

Open IuliiaHerets opened 1 day ago

IuliiaHerets commented 1 day ago

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: 9.0.38.0 Reproducible in staging?: Y Reproducible in production?: N/A - new feature, doesn't exist in prod Issue was found when executing this PR: https://github.com/Expensify/App/pull/45481 Issue reported by: Applause Internal Team

Action Performed:

  1. Go to https://staging.new.expensify.com/ and log in
  2. Navigate to Account settings > Troubleshoot
  3. Enable the debug mode toggle
  4. Navigate to any report
  5. Click on the header > Debug
  6. Long press left mouse button and swipe like selecting a text to copy

Expected Result:

The opened tab should not be changed

Actual Result:

It swipes to the next tab

Workaround:

Unknown

Platforms:

Screenshots/Videos

https://github.com/user-attachments/assets/87c3546f-29bb-4f4f-a692-24fc39a1cb35

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021836846411247309742
  • Upwork Job ID: 1836846411247309742
  • Last Price Increase: 2024-09-19
Issue OwnerCurrent Issue Owner: @brunovjk
melvin-bot[bot] commented 1 day ago

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

melvin-bot[bot] commented 1 day ago

Triggered auto assignment to @MarioExpensify (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

github-actions[bot] commented 1 day ago

:wave: Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

  1. Identify the pull request that introduced this issue and revert it.
  2. Find someone who can quickly fix the issue.
  3. Fix the issue yourself.
BhuvaneshPatil commented 1 day ago

Edited by proposal-police: This proposal was edited at 2024-09-19 19:01:04 UTC.

Proposal

PR - https://github.com/Expensify/App/pull/45481

I would not say it's regression but a missing case/observation while implementing the feature.

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

Web - Debug - RHP tabs can be swiped When we try to select text for copying and we swipe the mouse it changes the tab

What is the root cause of that problem?

This is default behaviour for tab navigation (check on submit expense view) where we can change between amount, bill and distance by swiping with mouse.

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

We can pass the options prop on these components TopTab.Screen

https://github.com/Expensify/App/blob/98dc643e14378f654e45a7ce96f35be9f407c007/src/pages/Debug/ReportAction/DebugReportActionPage.tsx#L54-L67

as -

options={{swipeEnabled: false}}

Based on design team we can add this value based on device (phone or desktop). We also need to add default options if there are any passed.

https://github.com/user-attachments/assets/0ef25e29-e161-4c01-b79e-cb56214ae6ef

If we want to change other pages where we use tab navigator we can update there as well

What alternative solutions did you explore? (Optional)

grgia commented 1 day ago

Demoting as it's a debug feature

melvin-bot[bot] commented 1 day ago

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

melvin-bot[bot] commented 1 day ago

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

1subodhpathak commented 22 hours ago

Proposal

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

Current implementation of OnyxTabNavigator does not support disabling the swipe gesture between tabs.

What is the root cause of that problem?

The swipeEnabled prop is not directly supported in the TopTab.Navigator component props. The proper place to pass this configuration is through the screenOptions prop, which allows customization of how individual screens behave.

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

What alternative solutions did you explore? (Optional)

1subodhpathak commented 22 hours ago

Updated proposal with proof of work:-

Before -

https://github.com/user-attachments/assets/f19cecb9-f60c-4498-aebf-a097b257501a

After code change-

https://github.com/user-attachments/assets/65200a50-18e4-4016-b547-3a859454e413

Krishna2323 commented 21 hours ago

Proposal


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

Web - Debug - RHP tabs can be swiped

What is the root cause of that problem?

shouldInterceptSwipe prop is not passed to the text inputs. https://github.com/Expensify/App/blob/25450d96aca5d30b0fef7bdbfc9379fa71e7cd74/src/pages/Debug/DebugDetails.tsx#L150-L221

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


What alternative solutions did you explore? (Optional)

Result

1subodhpathak commented 21 hours ago

Updated comment

brunovjk commented 4 hours ago

Hey everyone,

I've tested all of the proposals thoroughly, and here are my findings:

  1. Proposal using swipeEnabled:
    While disabling the swipe works, this solution doesn’t align with our current behavior. In other tabs (e.g., submit expense view), swiping between sections like amount, bill, and distance is the intended and default behavior. We don’t want to change that globally, so disabling swipe is not a viable solution.

  2. Proposal by @Krishna2323:
    I tested the fix that adds the shouldInterceptSwipe prop to TextInputs, and it works great for tabs where we use input fields. When I attempt to select text within an input, the swipe is correctly prevented. However, we still have an issue when trying to select regular text, which is not wrapped inside an input, like in the DebugJSON tab. While selecting text in this view, the swipe action still occurs, making it hard to copy the content.

https://github.com/user-attachments/assets/e19aa39e-bd66-4739-a2e9-bb37b79acb3e

Feel free to reach out if you have any ideas or suggestions! Let’s smash this bug together! 💪

Krishna2323 commented 3 hours ago

@brunovjk, we can wrap the text in a view and apply the same logic as below.

https://github.com/Expensify/App/blob/ee7cdad15183edf21a91c7e52aba3f24289b1214/src/components/TextInput/BaseTextInput/index.tsx#L290

brunovjk commented 2 hours ago

@brunovjk, we can wrap the text in a view and apply the same logic as below.

https://github.com/Expensify/App/blob/ee7cdad15183edf21a91c7e52aba3f24289b1214/src/components/TextInput/BaseTextInput/index.tsx#L290

Great @Krishna2323 can you include that in your proposal? I'll get back to you soon. Thanks!!

1subodhpathak commented 2 hours ago

can we import {Gesture, GestureDetector} from 'react-native-gesture-handler'; and then create a custom gesture handler?

Krishna2323 commented 2 hours ago

@brunovjk, proposal updated.

brunovjk commented 44 minutes ago

@1subodhpathak Perhaps, but as we use shouldInterceptSwipe for these cases, I believe it would be more prudent to follow the same pattern.

I think we can go with @Krishna2323's proposal. It’s important to ensure this fix is applied consistently across all tab pages to prevent similar issues.

🎀👀🎀 C+ reviewed

melvin-bot[bot] commented 44 minutes ago

Current assignee @MarioExpensify is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.