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

[$1000] Cursor appears zoom cursor for a moment and changes to normal cursor when opening profile pic from details page #16100

Closed
1 of 6 tasks
kavimuru opened this issue Mar 18, 2023 · 25 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@kavimuru
Copy link

kavimuru commented Mar 18, 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. Open the app in mac chrome/windows chrome
  2. Open report that has profile pic set
  3. Click on user profile image
  4. In details page, again click on profile image

Expected Result:

App should display image with normal cursor

From issue reporter:

The cursor should be generic when we click on attachment and it should display as zoom cursor only when we hover on the image part in the attachment preview. Mac safari does this task right, you can use that as reference point.

Actual Result:

App first displays image with zoom cursor and after some time changes the cursor back to normal cursor

Workaround:

unknown

Platforms:

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

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

Version Number: 1.2.87-0
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:

Recording.1731.mp4
cursor.fluctate.issue.mov

Expensify/Expensify Issue URL:
Issue reported by: @dhanashree-sawant
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1679128979658119

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~019c8aa50007c703f7
  • Upwork Job ID: 1640658402418044928
  • Last Price Increase: 2023-04-04
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Mar 18, 2023
@melvin-bot melvin-bot bot locked and limited conversation to collaborators Mar 18, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

MelvinBot commented Mar 18, 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 melvin-bot bot added the Overdue label Mar 21, 2023
@Expensify Expensify unlocked this conversation Mar 21, 2023
@MelvinBot
Copy link

@greg-schroeder Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@greg-schroeder
Copy link
Contributor

Back from OOO, reviewing

@melvin-bot melvin-bot bot removed the Overdue label Mar 23, 2023
@greg-schroeder
Copy link
Contributor

@dhanashree-sawant @kavimuru - I'm a little unclear on the expected behavior here. When is that zoom icon supposed to show up? Is it possible that it should be showing up and remaining when mousing over the photo? Or should it just be the generic cursor icon at all times?

Can you please clarify?

@dhanashree-sawant
Copy link

Hi @greg-schroeder, cursor should be generic when we click on attachment and it should display as zoom cursor only when we hover on the image part in the attachment preview. Mac safari does this task right, you can use that as reference point.

@melvin-bot melvin-bot bot added the Overdue label Mar 27, 2023
@greg-schroeder greg-schroeder added the External Added to denote the issue can be worked on by a contributor label Mar 28, 2023
@melvin-bot melvin-bot bot changed the title Cursor appears zoom cursor for a moment and changes to normal cursor when opening profile pic from details page [$1000] Cursor appears zoom cursor for a moment and changes to normal cursor when opening profile pic from details page Mar 28, 2023
@MelvinBot
Copy link

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

@greg-schroeder
Copy link
Contributor

Okay, got it! Updated OP with that clarification. Applied external

@MelvinBot
Copy link

Triggered auto assignment to @isabelastisser (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@MelvinBot
Copy link

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

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

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

@PrashantMangukiya
Copy link
Contributor

Proposal

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

When clicked profile pic, cursor appears zoom cursor for a moment and changes to normal cursor when opening profile pic from details page.

What is the root cause of that problem?

When we click profile image it will open AttachmentModel >> AttachmentView >> ImageView.
So within <ImageView> it will show image with Pressable as shown below, we can see at line 279 it is calling StyleUtils.getZoomCursorStyle() to get cursor style.

<Pressable
style={{
...StyleUtils.getZoomSizingStyle(this.state.isZoomed, this.state.imgWidth, this.state.imgHeight, this.state.zoomScale,
this.state.containerHeight, this.state.containerWidth),
...StyleUtils.getZoomCursorStyle(this.state.isZoomed, this.state.isDragging),
...this.state.isZoomed && this.state.zoomScale >= 1 ? styles.pRelative : styles.pAbsolute,
...styles.flex1,
}}

Here is the code for getZoomCursorStyle() function

function getZoomCursorStyle(isZoomed, isDragging) {
if (!isZoomed) {
return {cursor: 'zoom-in'};
}
return {
cursor: isDragging ? 'grabbing' : 'zoom-out',
};
}

This function receive two params isZoomed and isDragging so based on that it will return cursor style. Here function does not have any info about image width and height.

So actually what happen here, when <ImageView> load it will calculate image width and height. Initial state value for isZoomed is false, and imgHeight and imgWidth is zero. So during that time getZoomCursorStyle() will return cursor: 'zoom-in' at line 182 based on the isZoomed false value. Because this function does not know either image have some dimension (width and height) or not.

So during that fraction of time (i.e. until image dimension decided) it will show zoom-in cursor. This is the root cause of the problem.

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

Within src/components/ImageView/index.js we have to pass imageWidth and imageHeight to getZoomCursorStyle() function as shown below:

 <Pressable 
     style={{ 
        ...
        // ...StyleUtils.getZoomCursorStyle(this.state.isZoomed, this.state.isDragging),    // *** OLD CODE ***
        ...StyleUtils.getZoomCursorStyle(this.state.isZoomed, this.state.isDragging, this.state.imgWidth, this.state.imgHeight),   // *** UPDATED CODE ***
        ...
     }} 

Within src/styles/StyleUtils.js update getZoomCursorStyle() function as shown below.
i.e. add imgWidth and imgHeight params to function and put if condition as shown below. So if image dimension zero it will return default cursor.

function getZoomCursorStyle(isZoomed, isDragging, imgWidth, imgHeight) {
    // Add below if condition
    if (imgWidth === 0 || imgHeight === 0) {
        return {cursor: 'default'};
    }

    if (!isZoomed) {
        return {cursor: 'zoom-in'};
    }

    return {
        cursor: isDragging ? 'grabbing' : 'zoom-out',
    };
}

So this will solve the problem, we can see the results.

What alternative solutions did you explore? (Optional)

None

Result
Image-open-cursor.mov

@melvin-bot melvin-bot bot added the Overdue label Mar 31, 2023
@grgia
Copy link
Contributor

grgia commented Mar 31, 2023

@aimane-chnaif could you take a look at this proposal if you get a chance?

@melvin-bot melvin-bot bot removed the Overdue label Mar 31, 2023
@aimane-chnaif
Copy link
Contributor

I confirmed that cursor issue was gone in v1.2.89-0 after #15663 merged.
Instead, it introduced another flicker issue (should be regression). As seen in video, image zoomed in for a brief moment:

bug.mov

@grgia should we handle this issue here?

@MelvinBot
Copy link

@greg-schroeder @grgia @aimane-chnaif this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

@melvin-bot melvin-bot bot added the Overdue label Apr 3, 2023
@MelvinBot
Copy link

@greg-schroeder, @grgia, @aimane-chnaif Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@MelvinBot
Copy link

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@mvtglobally
Copy link

Issue not reproducible during KI retests. (First week)

@grgia
Copy link
Contributor

grgia commented Apr 5, 2023

@aimane-chnaif let's make sure there's a separate issue for the flicker effect. We can then close out this issue.

@melvin-bot melvin-bot bot removed the Overdue label Apr 5, 2023
@aimane-chnaif
Copy link
Contributor

ok, let's close. I just found out that issue - #16528 (comment)

@dhanashree-sawant
Copy link

Hi @grgia , @aimane-chnaif if closed, will it be eligible for reporting bonus?

@melvin-bot melvin-bot bot added the Overdue label Apr 7, 2023
@grgia
Copy link
Contributor

grgia commented Apr 7, 2023

@dhanashree-sawant

From the Contributing Guide:

If the bug is fixed by a PR that is not associated with your bug report, then you will not be eligible for the corresponding compensation unless you can find the PR that fixed it and prove your bug report came first.

It looks like the issue that the PR fixed links back to an issue from 2022, so I don't believe this is eligible for the reporting bonus unless you can prove that your bug report came first.

cc @greg-schroeder if you have any input on this

@melvin-bot melvin-bot bot removed the Overdue label Apr 7, 2023
@dhanashree-sawant
Copy link

Hi @grgia , sounds fair, thanks for the reply

@greg-schroeder
Copy link
Contributor

You are correct @grgia

@greg-schroeder
Copy link
Contributor

Closing per discussion above

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 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

9 participants