Material-ui: [Tooltip] Component fire on resize event of the iframe

Created on 26 Oct 2020  路  5Comments  路  Source: mui-org/material-ui

Current Behavior 馃槸

When a user hover on button with tooltip the onresize event of the iframe fired

Expected Behavior 馃

The onresize event shouldn't be fired

Steps to Reproduce 馃暪

  1. Go to https://codesandbox.io/s/muddy-violet-hcnkt?file=/src/App.js
  2. Open the console.log
  3. Hover on the icon button

Context 馃敠

Your Environment 馃寧

| Tech | Version |
| ----------- | ------- |
| Material-UI | v5.?.? |
| React | |
| Browser | |
| TypeScript | |
| etc. | |

bug 馃悰 Tooltip

Most helpful comment

The onresize event shouldn't be fired

@aviyi What issue does it trigger on your application? I mean, why is this important?

Could it be a problem with popper.js?

iframe size recalculated and cause rerender ...

All 5 comments

Thanks for the report.

Technical explanation: The tooltip has its own box and no position: absolute; when closed. Once we open it, we apply position: absolute and the required transform. There seems to be a timing issue (probably explainable by the browser render pipeline) that results in the iframe being considered resized. You can visualize this by using <Tooltip PopperProps={{keepMounted:true}} />.

I think I have a fix for this but I also observed some oddities about Tooltip inline styles.

The onresize event shouldn't be fired

@aviyi What issue does it trigger on your application? I mean, why is this important?

Could it be a problem with popper.js?

@aviyi What issue does it trigger on your application? I mean, why is this important?

Any events triggering unexpectedly or when they're not supposed to is a problem. Non-deterministic side-effects in general are problematic. This shouldn't be confused with React's render being non-deterministic.

Could it be a problem with popper.js?

Not sure how this is helpful.

If you put on the MuiTooltip-popper class top :0 . it will fix this issue

The onresize event shouldn't be fired

@aviyi What issue does it trigger on your application? I mean, why is this important?

Could it be a problem with popper.js?

iframe size recalculated and cause rerender ...

Was this page helpful?
0 / 5 - 0 ratings