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

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

Open
1 of 6 tasks
IuliiaHerets opened this issue Sep 19, 2024 · 24 comments
Open
1 of 6 tasks

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

IuliiaHerets opened this issue Sep 19, 2024 · 24 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Sep 19, 2024

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: #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:

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6608974_1726758147798.Recording__801.mp4

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
  • Automatic offers:
    • brunovjk | Reviewer | 104110789
    • Krishna2323 | Contributor | 104110791
Issue OwnerCurrent Issue Owner: @brunovjk
@IuliiaHerets IuliiaHerets added DeployBlockerCash This issue or pull request should block deployment Bug Something is broken. Auto assigns a BugZero manager. labels Sep 19, 2024
Copy link

melvin-bot bot commented Sep 19, 2024

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.

Copy link

melvin-bot bot commented Sep 19, 2024

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

@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Sep 19, 2024
Copy link
Contributor

👋 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
Copy link
Contributor

BhuvaneshPatil commented Sep 19, 2024

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

Proposal

PR - #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

<TopTab.Screen name={CONST.DEBUG.DETAILS}>
{() => (
<DebugDetails
data={reportAction}
onSave={(data) => {
Debug.mergeDebugData(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {[reportActionID]: data});
}}
onDelete={() => {
Debug.mergeDebugData(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, {[reportActionID]: null});
}}
validate={DebugUtils.validateReportActionDraftProperty}
/>
)}
</TopTab.Screen>

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.

Screen.Recording.2024-09-20.at.12.26.45.AM.mov

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 grgia removed the DeployBlockerCash This issue or pull request should block deployment label Sep 19, 2024
@grgia
Copy link
Contributor

grgia commented Sep 19, 2024

Demoting as it's a debug feature

@grgia grgia added the External Added to denote the issue can be worked on by a contributor label Sep 19, 2024
@melvin-bot melvin-bot bot changed the title Web - Debug - RHP tabs can be swiped [$250] Web - Debug - RHP tabs can be swiped Sep 19, 2024
Copy link

melvin-bot bot commented Sep 19, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Sep 19, 2024
@grgia grgia added Daily KSv2 and removed Hourly KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors labels Sep 19, 2024
Copy link

melvin-bot bot commented Sep 19, 2024

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

@1subodhpathak
Copy link
Contributor

1subodhpathak commented Sep 19, 2024

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?

  • We should modify the OnyxTabNavigator component to accept swipeEnabled as part of the screenOptions configuration.
  • Then, update the TopTab.Navigator to pass swipeEnabled: false within the screenOptions to disable the swipe gesture, which aligns with the React Navigation API documentation.
    screenOptions={defaultScreenOptions}
screenOptions={{
     ...defaultScreenOptions,
     swipeEnabled: false,
}}

This change will allow us to control whether users can swipe between tabs or not, based on specific use cases.

What alternative solutions did you explore? (Optional)

@1subodhpathak
Copy link
Contributor

1subodhpathak commented Sep 19, 2024

Updated proposal with proof of work:-

Before -

Recording.2024-09-20.Before.mp4

After code change-

Recording.2024-09-20.023122.mp4

@Krishna2323
Copy link
Contributor

Krishna2323 commented Sep 19, 2024

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.

<InputWrapper
InputComponent={TextInput}
inputID={key}
accessibilityLabel={key}
shouldSaveDraft
forceActiveLabel
label={key}
numberOfLines={numberOfLines}
multiline={numberOfLines > 1}
defaultValue={value}
disabled={DETAILS_DISABLED_KEYS.includes(key as DetailsDisabledKeys)}
/>
);
})}
{textFields.length === 0 && <Text style={[styles.textNormalThemeText, styles.ph5]}>None</Text>}
</View>
<Text style={[styles.headerText, styles.ph5, styles.mb3]}>{translate('debug.numberFields')}</Text>
<View style={[styles.mb5, styles.ph5, styles.gap5]}>
{numberFields.map(([key, value]) => (
<InputWrapper
InputComponent={TextInput}
inputID={key}
accessibilityLabel={key}
shouldSaveDraft
forceActiveLabel
label={key}
defaultValue={String(value)}
disabled={DETAILS_DISABLED_KEYS.includes(key as DetailsDisabledKeys)}
/>
))}
{numberFields.length === 0 && <Text style={[styles.textNormalThemeText, styles.ph5]}>None</Text>}
</View>
<Text style={[styles.headerText, styles.ph5, styles.mb3]}>{translate('debug.constantFields')}</Text>
<View style={styles.mb5}>
{constantFields.map(([key, value]) => (
<InputWrapper
key={key}
InputComponent={ConstantSelector}
inputID={key}
name={key}
shouldSaveDraft
defaultValue={String(value)}
/>
))}
{constantFields.length === 0 && <Text style={[styles.textNormalThemeText, styles.ph5]}>None</Text>}
</View>
<Text style={[styles.headerText, styles.ph5, styles.mb3]}>{translate('debug.dateTimeFields')}</Text>
<View style={styles.mb5}>
{dateTimeFields.map(([key, value]) => (
<InputWrapper
key={key}
InputComponent={DateTimeSelector}
inputID={key}
name={key}
shouldSaveDraft
defaultValue={String(value)}
/>
))}
{dateTimeFields.length === 0 && <Text style={[styles.textNormalThemeText, styles.ph5]}>None</Text>}
</View>
<Text style={[styles.headerText, styles.ph5, styles.mb3]}>{translate('debug.booleanFields')}</Text>
<View style={[styles.mb5, styles.ph5, styles.gap5]}>
{booleanFields.map(([key, value]) => (
<InputWrapper
InputComponent={CheckboxWithLabel}
label={key}
inputID={key}
shouldSaveDraft
accessibilityLabel={key}
defaultValue={value}
/>
))}

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


  • Add shouldInterceptSwipe prop to all TextInputs.
  • We should also check other tabs pages.
  • For DebugJson tab we can wrap the text in a view and apply the same logic as below.

What alternative solutions did you explore? (Optional)

Result

@1subodhpathak
Copy link
Contributor

Updated comment

@brunovjk
Copy link
Contributor

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.

Screen.Recording.2024-09-20.at.12.22.11.mov

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

@Krishna2323
Copy link
Contributor

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

{...(shouldInterceptSwipe && SwipeInterceptPanResponder.panHandlers)}

@brunovjk
Copy link
Contributor

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

{...(shouldInterceptSwipe && SwipeInterceptPanResponder.panHandlers)}

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

@1subodhpathak
Copy link
Contributor

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

@Krishna2323
Copy link
Contributor

@brunovjk, proposal updated.

@brunovjk
Copy link
Contributor

@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

Copy link

melvin-bot bot commented Sep 20, 2024

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

1 similar comment
Copy link

melvin-bot bot commented Sep 23, 2024

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

@joekaufmanexpensify
Copy link
Contributor

@MarioExpensify Do you think you'll have a chance to sign off on this proposal soon?

Copy link

melvin-bot bot commented Sep 24, 2024

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

Copy link

melvin-bot bot commented Sep 24, 2024

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

@MarioExpensify
Copy link

@Krishna2323 sounds good, thank you and thanks @brunovjk! Waiting for the PR on this one.

@joekaufmanexpensify
Copy link
Contributor

@Krishna2323 is there an ETA for PR here?

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 Engineering External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

8 participants