You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Especially, the window.getComputedStyle invocation in getStyleComputedProperty may force a style re-evaluation in some cases, causing performance issue.
Below is the flamechart of the example provided, when rendering 10 buttons with tooltips. (The time numbers may exaggerate as I've enabled 6x CPU slowdown to retrieve the complete stack track)
The example I've provided with this issue represents a typical scenario where such performance issue has been observed:
User opens our web app.
During web app initialization, we trigger a React component state change.
By changing the component state,
we change the styles of some parent <div> or <body> elements. (this is important to reproduce such a perf issue)
we also adds some buttons with tooltips inside the <div> element.
And we observed some browser freeze when performing the React state update, and we see a large chunk of time taken in "Recalculate Style".
Please open the sample provided, uncheck "Render buttons with tooltips", click "Render buttons", and see console output. Then after refreshing the browser check "Render buttons with tooltips", click "Render buttons", and see console output.
Actual Behavior
"Render buttons with tooltips" unchecked
"Render buttons with tooltips" checked
Expected Behavior
I don't expect to see a 5ms -> 15ms change to render the Buttons, only because I've added Tooltips for them.
Logs
No response
Requested priority
Normal
Products/sites affected
No response
Are you willing to submit a PR to fix?
yes
Validations
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
The provided reproduction is a minimal reproducible example of the bug.
The text was updated successfully, but these errors were encountered:
Library
React Components / v9 (@fluentui/react-components)
System Info
Are you reporting Accessibility issue?
no
Reproduction
https://codesandbox.io/s/tooltip-and-computed-style-b9wvlh?file=/example.tsx
Bug Description
After wrapping components in
<Tooltip>
, we observe significant time consumed bygetScrollParent
function.fluentui/packages/react-components/react-positioning/src/utils/getScrollParent.ts
Line 48 in a965446
Especially, the
window.getComputedStyle
invocation ingetStyleComputedProperty
may force a style re-evaluation in some cases, causing performance issue.fluentui/packages/react-components/react-positioning/src/utils/getScrollParent.ts
Line 25 in a965446
Below is the flamechart of the example provided, when rendering 10 buttons with tooltips. (The time numbers may exaggerate as I've enabled 6x CPU slowdown to retrieve the complete stack track)
The example I've provided with this issue represents a typical scenario where such performance issue has been observed:
<div>
or<body>
elements. (this is important to reproduce such a perf issue)<div>
element.And we observed some browser freeze when performing the React state update, and we see a large chunk of time taken in "Recalculate Style".
Please open the sample provided, uncheck "Render buttons with tooltips", click "Render buttons", and see console output. Then after refreshing the browser check "Render buttons with tooltips", click "Render buttons", and see console output.
Actual Behavior
"Render buttons with tooltips" unchecked
"Render buttons with tooltips" checked
Expected Behavior
I don't expect to see a 5ms -> 15ms change to render the Buttons, only because I've added Tooltips for them.
Logs
No response
Requested priority
Normal
Products/sites affected
No response
Are you willing to submit a PR to fix?
yes
Validations
The text was updated successfully, but these errors were encountered: