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 2023-10-24] [$500] mWeb - Scan - Page is skewed when dragging Scan content to the right #28689

Closed
1 of 6 tasks
izarutskaya opened this issue Oct 3, 2023 · 27 comments
Assignees
Labels
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

@izarutskaya
Copy link

izarutskaya commented Oct 3, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to + > Request money > Scan.
  3. Highlight the text in the Scan tab.
  4. Drag the content to the right.

Expected Result:

The page will not be skewed.

Actual Result:

The page is skewed.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: v1.3.76-1

Reproducible in staging?: Y

Reproducible in production?: Y

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

Notes/Photos/Videos: Any additional supporting documentation

Bug6222685_1696298663769.Screen_Recording_20231003_034204_Chrome.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause-Internal Team

Slack conversation: @

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0169e8ba6785ac7a07
  • Upwork Job ID: 1709118057164894208
  • Last Price Increase: 2023-10-03
  • Automatic offers:
    • ZhenjaHorbach | Contributor | 27166771
Issue OwnerCurrent Issue Owner: @anmurali
@izarutskaya izarutskaya added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 3, 2023
@melvin-bot melvin-bot bot changed the title mWeb - Scan - Page is skewed when dragging Scan content to the right [$500] mWeb - Scan - Page is skewed when dragging Scan content to the right Oct 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 3, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 3, 2023

Triggered auto assignment to @anmurali (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 3, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 3, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot
Copy link

melvin-bot bot commented Oct 3, 2023

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

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Oct 3, 2023

Proposal

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

During copy text we can drag screen

What is the root cause of that problem?

On mobile devices
Text selection does not affect dragging

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

The hard way

For MoneyRequestSelectorPage

We can create a new state that will be responsible for the selected text

For selecting text we can use listener like

    document.onmouseup = () => {
        setSelectedText(window.getSelection().toString());
    };

And when our state will not be empty
We can disable dragging using swipeEnabled for <TopTab.Navigator>

            screenOptions={{
                swipeEnabled: !SelectedText
            }}

<TopTab.Navigator
/* eslint-disable-next-line react/jsx-props-no-spreading */
{...rest}
id={id}
initialRouteName={selectedTab}
backBehavior="initialRoute"
keyboardDismissMode="none"
screenListeners={{
state: (event) => {
const state = event.data.state;
const index = state.index;
const routeNames = state.routeNames;
Tab.setSelectedTab(id, routeNames[index]);
},
...(rest.screenListeners || {}),
}}
>

The easy way

We can just turn off text selection
Using selectable={false}
Especially in this case
When we have a special button to copy the link

<View
style={styles.receiptViewTextContainer}
// eslint-disable-next-line react/jsx-props-no-spreading
{...panResponder.panHandlers}
>
<Text style={[styles.textReceiptUpload]}>{translate('receipt.upload')}</Text>
<Text style={[styles.subTextReceiptUpload]}>
{isSmallScreenWidth ? translate('receipt.chooseReceipt') : translate('receipt.dragReceiptBeforeEmail')}
<CopyTextToClipboard
text={CONST.EMAIL.RECEIPTS}
textStyles={[styles.textBlue]}
/>
{isSmallScreenWidth ? null : translate('receipt.dragReceiptAfterEmail')}
</Text>
</View>

What alternative solutions did you explore? (Optional)

NA

@AmjedNazzal
Copy link
Contributor

AmjedNazzal commented Oct 4, 2023

Proposal

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

mWeb - Scan - Page is skewed when dragging Scan content to the right

What is the root cause of that problem?

The reason for this is with the way createMaterialTopTabNavigator is designed, when we pass multiple screens to createMaterialTopTabNavigator what it does is take these components and put them side by side like a carousel to allow for swiping, what this means is for the browsers this is just one element with bigger than screen width and so when selecting text, to the browser all text within the entire element is selectable together leading to the selection caret jumping to the next tab and causing misalignment

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

We first should prevent the misalignment, we can do that by simply applying overflow clip to OnyxTabNavigator

<OnyxTabNavigator
    style={{ overflow: 'clip' }}

Next we can create a manual handling of selection to not allow selection to go to the next tab, from what I could test it seem like the only tab this could happen is receiptSelector so we can make a function to handle the selection there:

const onSelectionChange = () => {
    const selection = window.getSelection();
    const { anchorNode, anchorOffset, focusNode, focusOffset } = selection;
    
    if (textRef.current) {
        if (textRef.current.contains(focusNode)){
            setSelectionPoints({
                start: anchorOffset,
                end: focusOffset
            });
            anchorNodeRef.current = anchorNode;
            focusNodeRef.current = focusNode;
        }
        if (!textRef.current.contains(focusNode)) {
            selection.removeAllRanges();
            setTimeout(() => {
                selection.setBaseAndExtent(anchorNodeRef.current, selectionPoints.start, focusNodeRef.current, selectionPoints.end);
            }, 100);
        }
      }
}

useEffect(() => {
    document.addEventListener('selectionchange', onSelectionChange);
    return () => {
      document.removeEventListener('selectionchange', onSelectionChange);
    };
  }, [selectionPoints]);

By doing this we allow selection exclusivly to the element ref that we want to be selectable.

Result

WhatsApp.Video.2023-10-04.at.5.52.06.PM.mp4

@melvin-bot melvin-bot bot added the Overdue label Oct 5, 2023
@narefyev91
Copy link
Contributor

Proposal from @ZhenjaHorbach looks good to me #28689 (comment)
We should use simple fix and just disable selection for text
We already have the same behaviour here
Screenshot 2023-10-05 at 10 41 25
🎀 👀 🎀 C+ reviewed

@melvin-bot melvin-bot bot removed the Overdue label Oct 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 6, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

@marcochavezf, @anmurali, @narefyev91 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

❌ There was an error making the offer to @ZhenjaHorbach for the Contributor role. The BZ member will need to manually hire the contributor. cc @thienlnam

@marcochavezf
Copy link
Contributor

Thanks for the review @narefyev91, assigned @ZhenjaHorbach

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 9, 2023
@marcochavezf
Copy link
Contributor

marcochavezf commented Oct 12, 2023

Not overdue, @ZhenjaHorbach when would a PR be ready for review?

@melvin-bot melvin-bot bot removed the Overdue label Oct 12, 2023
@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Oct 12, 2023

❌ There was an error making the offer to @ZhenjaHorbach for the Contributor role. The BZ member will need to manually hire the contributor. cc @thienlnam

@marcochavezf
Oh, sorry
I forgot to write about this problem
Can you try to unassign and assign me again?
Because I didn't get an offer

@marcochavezf
Copy link
Contributor

Sure, I will try again

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Oct 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

🎯 ⚡️ Woah @narefyev91 / @ZhenjaHorbach, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @ZhenjaHorbach got assigned: 2023-10-12 19:38:25 Z
  • when the PR got merged: 2023-10-16 18:17:20 UTC

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 17, 2023
@melvin-bot melvin-bot bot changed the title [$500] mWeb - Scan - Page is skewed when dragging Scan content to the right [HOLD for payment 2023-10-24] [$500] mWeb - Scan - Page is skewed when dragging Scan content to the right Oct 17, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 17, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 17, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 17, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.85-4 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 2023-10-24. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 17, 2023

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@narefyev91] The PR that introduced the bug has been identified. Link to the PR:
  • [@narefyev91] 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:
  • [@narefyev91] A discussion in #expensify-bugs 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:
  • [@narefyev91] Determine if we should create a regression test for this bug.
  • [@narefyev91] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@anmurali] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Oct 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 27, 2023

@marcochavezf, @anmurali, @narefyev91, @ZhenjaHorbach Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@melvin-bot
Copy link

melvin-bot bot commented Oct 31, 2023

@marcochavezf, @anmurali, @narefyev91, @ZhenjaHorbach Still overdue 6 days?! Let's take care of this!

@anmurali
Copy link

Paid @ZhenjaHorbach with urgency bonus

@anmurali anmurali removed the Awaiting Payment Auto-added when associated PR is deployed to production label Oct 31, 2023
@anmurali
Copy link

@narefyev91 can you complete the BZ checklist?

@anmurali anmurali removed the Overdue label Nov 1, 2023
@melvin-bot melvin-bot bot added the Overdue label Nov 1, 2023
@anmurali anmurali added Weekly KSv2 and removed Daily KSv2 labels Nov 1, 2023
@melvin-bot melvin-bot bot removed the Overdue label Nov 1, 2023
@narefyev91
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR - N/A - it was not a regression - just additional functionality
  • 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 - N/A
  • A discussion in #expensify-bugs 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
  • Determine if we should create a regression test for this bug - N/A

@melvin-bot melvin-bot bot added the Overdue label Nov 9, 2023
@marcochavezf
Copy link
Contributor

I think there's nothing left here, sop I will close it out but feel free to re-open it if there's still something pending.

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

No branches or pull requests

6 participants