Performance: Tooltip is expensive render on hover regardless of the delay.
Chrome
- Package version(s): (fill this out)
- Browser and OS versions: (fill this out if relevant)
Please provide a reproduction of the bug in a codepen:
Actual behavior:
https://developer.microsoft.com/en-us/fabric#/controls/web/tooltip
<CallOut> is relative expensive due to the nature of the implementation which need to determine where to pop the call out on position (which imply force render during the requestAnimation.
<ToolsTipContainer> which render <ToolsTip> <Tooltip> which leverage, the <Callout> except have a misleading delay property, As it turn out, that delay is only a style. When user hover it is, it already force all that caculation and update the id (DOM changes etc.)
I'd thought that "delay" should debounce the force-render & force caculation if user mouse out at the 500 ms.
https://github.com/OfficeDev/office-ui-fabric-react/blob/846c063f27dbc440ea9773ff735420d0ba7c1754/packages/office-ui-fabric-react/src/components/Tooltip/TooltipHost.base.tsx#L71
As it turn out, NO, it always render the call out, only CSS "animation" to delay the show .
Question: why do we force-render always even when user glide through a list of buttons with tool tips. & only with "animation" fade-in delay.
https://github.com/OfficeDev/office-ui-fabric-react/blob/846c063f27dbc440ea9773ff735420d0ba7c1754/packages/office-ui-fabric-react/src/components/Tooltip/Tooltip.styles.ts#L16
Suggestion: can we debounce base on the TooltipHost delay that actually save the render performance?
Expected behavior:
ToolsTipHost.delay will actually shave force-rendering need for <Callout&tg; rather than fake perceived CSS style of animation delay of fade in.
Here is <Callout> get the actual high. https://github.com/OfficeDev/office-ui-fabric-react/blob/846c063f27dbc440ea9773ff735420d0ba7c1754/packages/office-ui-fabric-react/src/components/Callout/CalloutContent.base.tsx#L374
Priorities and help requested:
Are you willing to submit a PR to fix? (Yes, No)
Requested priority: (Blocking, High, Normal, Low)
Products/sites affected: (if applicable)
Hi @LiangMingChen, the delay was never intended to lazy load the control, just to delay the visibility. Webpack 4 might have ways to lazyload unnecessary content but we can't really change how the files are loaded ourselves - that requires build time processing we can't bake into our components. You might have to create 2 bundles for this app - one without the layer and one with.
No, I don't think this is delay load issue, it should not render the <Callout> thus cause the force render . If you don't understand on what's the render cost impact the performance, you should really look up the following -- it have nothing to do with delay load Chrome Dev Lead have page on this. https://gist.github.com/paulirish/5d52fb081b3570c81e3a
Rendering on the Web: Performance Implications of Application Architecture (Google I/O ’19) https://www.youtube.com/watch?v=k-A2VfuUROg


@LiangMingChen Are you referring to using <DelayedRender> to wrap the <Callout> inside Tooltip so that if there's a delay and you hover over a tooltip but leave before the delay's done, the tooltip doesn't render?
@LiangMingChen please checkout this PR #9341 and let us know if this is what you had in mind too.
@LiangMingChen please checkout this PR #9341 and let us know if this is what you had in mind too.
Yes, that's what I have in mind. I have put the comment on the CSS class, since we have this, we should consider remove the https://github.com/OfficeDev/office-ui-fabric-react/blob/8a471edeec02db18f201db9790da374c573f9f2b/packages/office-ui-fabric-react/src/components/Tooltip/Tooltip.styles.ts#L16
All the delayAnimation style should remove?
In addition delay for tooltip is a Enum (0, 1, 2), that should be update with ms?
:tada:This issue was addressed in #9341, which has now been successfully released as [email protected].:tada:
Handy links:
#9341 is reverted with #9495 so opening this back up.
Closing it due to the issue being fixed in #9845