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] Chat - Tooltip vibrates when moving cursor over it and does not automatically resize #22840

Closed
1 of 6 tasks
lanitochka17 opened this issue Jul 13, 2023 · 15 comments
Closed
1 of 6 tasks
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

@lanitochka17
Copy link

lanitochka17 commented Jul 13, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

Precondition: The workspace must have a short name

  1. Go to staging.new.expensify.com
  2. Go to workspace chat
  3. Go to Settings > Workspace > workspace with short name > Settings
  4. Change the workspace name to a very long name
  5. Save the edit
  6. Close workspace menu
  7. Hover over the workspace icon in the workspace chat
  8. Keep moving cursor over the workspace icon
  9. Switch to other conversation
  10. Switch back to workspace chat and hover over the workspace icon again

Expected Result:

In Step 7 and 8, the tooltip automatically resizes according to the workspace name. There will be no viibration effect when moving over the workspace icon

Actual Result:

In Step 7 and 8, the tooltip is not resized. When hovering and moving cursor over workspace icon, the tooltip is vibrating. The tooltip only resizes after switching to other chat and back to workspace chat

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.3.40.2

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

Bug6127100_20230714_005538.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f0bc95c39f3ce8e0
  • Upwork Job ID: 1680878186075922432
  • Last Price Increase: 2023-07-17
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 13, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 13, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 13, 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

@StevenKKC
Copy link
Contributor

Proposal

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

After change the workspace name to a long name, tooltip vibrates when moving cursor over it and does not automatically resize.

What is the root cause of that problem?

Workspace name is fetched and displayed as below code,

if (props.icon && (props.icon.type === CONST.ICON_TYPE_WORKSPACE || !title)) {
title = props.icon.name;
}

<Text style={[styles.mt2, styles.textMicroBold, styles.textReactionSenders, styles.textAlignCenter]}>{title}</Text>

Tooltip component will remount when renderTooltipContentKey changes.

<Tooltip
renderTooltipContent={renderTooltipContent}
renderTooltipContentKey={[userDisplayName, userLogin]}
>
{props.children}
</Tooltip>

// We pass a key, so whenever the content changes this component will completely remount with a fresh state.
// This prevents flickering/moving while remaining performant.
key={[this.props.text, ...this.props.renderTooltipContentKey, this.props.preferredLocale]}

userDisplayName and userLogin are fetched from personalDetailsList, so when workspace name changes, these value does not change.

const userDetails = lodashGet(props.personalDetailsList, props.accountID, props.fallbackUserDetails);
let userDisplayName = userDetails.displayName ? userDetails.displayName.trim() : '';
let userLogin = (userDetails.login || '').trim() && !_.isEqual(userDetails.login, userDetails.displayName) ? Str.removeSMSDomain(userDetails.login) : '';

Therefore, Tooltip component does not remount, so the width does not automatically change.

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

We should pass proper renderTooltipContentKey to Tooltip component as below.

    <Tooltip
        renderTooltipContent={renderTooltipContent}
-       renderTooltipContentKey={[userDisplayName, userLogin]}
+       renderTooltipContentKey={[userDisplayName || title, userLogin]}
    >
        {props.children}
    </Tooltip>

What alternative solutions did you explore? (Optional)

None.

@melvin-bot melvin-bot bot added the Overdue label Jul 17, 2023
@bfitzexpensify
Copy link
Contributor

Reproduced.

@melvin-bot melvin-bot bot removed the Overdue label Jul 17, 2023
@bfitzexpensify bfitzexpensify added the External Added to denote the issue can be worked on by a contributor label Jul 17, 2023
@melvin-bot melvin-bot bot changed the title Chat - Tooltip vibrates when moving cursor over it and does not automatically resize [$1000] Chat - Tooltip vibrates when moving cursor over it and does not automatically resize Jul 17, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 17, 2023

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

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

melvin-bot bot commented Jul 17, 2023

Current assignee @bfitzexpensify is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jul 17, 2023

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

@misgana96
Copy link

I will use CSS tricks to stop tooltip vibrates like "pointer-event"

  • for the issue of tooltip size I will use Flexbox to be flexible for the size of the name, I write some CSS code using Flexbox since after saving the name we have seen the updated name but not with the new tooltip size.

@melvin-bot
Copy link

melvin-bot bot commented Jul 17, 2023

📣 @misgana96! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@misgana96
Copy link

Contributor details
Your Expensify account email: misganayoseph@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~018a20230bafe0113c

@melvin-bot
Copy link

melvin-bot bot commented Jul 17, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@s77rt
Copy link
Contributor

s77rt commented Jul 17, 2023

@StevenKKC Thanks for the proposal. Your RCA makes sense that the tooltip content has 3 sources (userDisplayName, userLogin and props.icon.name) but we only account for 2. We can either add the missing source props.icon.name or just use title and subtitle directly (those two variables make use of the three sources) i.e. renderTooltipContentKey={[title, subtitle]}. However I have some concerns related to the behaviour of the tooltip, here we have renderTooltipContent function wrapped in a callback that changes whenever any of those 3 sources change resulting in a new function where the tooltip should re-render without the need to renderTooltipContentKey. Any idea why this is not the case or is it? (also asking here)

BTW are you still able to constantly reproduce the bug? I was able to reproduce it once but now I can't, and even that I omitted the renderTooltipContentKey prop, the bug is still not reproducible.

@s77rt
Copy link
Contributor

s77rt commented Jul 17, 2023

@misgana96 Thanks for your interest here. For proposals we have a proposal template. Please checkout the contributing guide.

@StevenKKC
Copy link
Contributor

StevenKKC commented Jul 18, 2023

@s77rt I'm also unable to reproduce this bug. I think this issue have fixed by this PR.
In this PR, if does not have a data for new user, then provide fallback user details.
And in case of workspace, the fallback data includes workspace name, so userDisplayName has a workspace name, and Tooltip displays as well.

renderTooltipContent function re-render Tooltip component, but it's width is calculated when the component mounts, and does not change in re-render.
Tooltip is rendered using TooltipRenderedOnPageBody.
As you can see in following code comments, only if renderTooltipContentKey has changed, the component will be re-mount (not re-render), and width will be calculated correctly.

<TooltipRenderedOnPageBody
animation={this.animation}
windowWidth={this.props.windowWidth}
xOffset={this.state.xOffset}
yOffset={this.state.yOffset}
targetWidth={this.state.wrapperWidth}
targetHeight={this.state.wrapperHeight}
shiftHorizontal={_.result(this.props, 'shiftHorizontal')}
shiftVertical={_.result(this.props, 'shiftVertical')}
text={this.props.text}
maxWidth={this.props.maxWidth}
numberOfLines={this.props.numberOfLines}
renderTooltipContent={this.props.renderTooltipContent}
// We pass a key, so whenever the content changes this component will completely remount with a fresh state.
// This prevents flickering/moving while remaining performant.
key={[this.props.text, ...this.props.renderTooltipContentKey, this.props.preferredLocale]}
/>

// Props will change frequently.
// On every tooltip hover, we update the position in state which will result in re-rendering.
// We also update the state on layout changes which will be triggered often.
// There will be n number of tooltip components in the page.
// It's good to memoize this one.
const TooltipRenderedOnPageBody = (props) => {
// The width of tooltip's inner content. Has to be undefined in the beginning
// as a width of 0 will cause the content to be rendered of a width of 0,
// which prevents us from measuring it correctly.
const [contentMeasuredWidth, setContentMeasuredWidth] = useState(undefined);

Thanks for your reply anyway. I think we can close this issue.

@bfitzexpensify
Copy link
Contributor

I'm also unable to reproduce now. Agreed that #22693 likely solved this, and agreed with closing this out.

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

5 participants